Skip to content

Conversation

@chengyouling
Copy link
Contributor

No description provided.

…ed when enabling RBAC authentication in a dual-engine disaster recovery scenario.
@chengyouling chengyouling self-assigned this Nov 18, 2025
addressAutoRefreshed = addresses.stream().anyMatch(addr -> addr.contains(ZONE) || addr.contains(REGION));
for (String address : addresses) {
// Compatible IpPortManager init address is 127.0.0.1:30100
if (!address.startsWith("http")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider https?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used only to determine whether an protocol is included, not to determine the type of protocol.

tempList.add(endpoint.toString());
buildAffinityAddress(endpoint, ownRegion, ownAvailableZone);
}
this.addresses.addAll(isFormat ? this.transformAddress(tempList) : tempList);
Copy link
Contributor

@caimo caimo Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addresses items will duplicate? or else change to Set , if order is not needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need order, and duplicate addresses are acceptable.

private void buildAffinityAddress(URLEndPoint endpoint, String ownRegion, String ownAvailableZone) {
if (addressAutoRefreshed) {
if (regionAndAZMatch(ownRegion, ownAvailableZone, endpoint.getFirst(REGION), endpoint.getFirst(ZONE))) {
availableZone.add(endpoint.toString());
Copy link
Contributor

@caimo caimo Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toString is not Recommendation, the result will changed when the class field added.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The toString method in URLEndPoint has been overridden, and properties can be added when needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the availableZone mean always not changed when URLEndPoint add properties?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

URLEndPoint is just a utility class, the SC address only requires the protocol+ip+port

signRequest.setEndpoint(uri);
return signRequest;
} catch (Exception e) {
return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log it , when exception

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

if (StringUtils.isEmpty(address)) {
address = registryName;
}
synchronized (LOCK) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use caffeine instead ? sync lock is Not recommended. it just a read operation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache loads tokens when they are not stored during queries, and it involves asynchronous tasks, which may lead to concurrency issues. Caffeine without having trie, it is unknown whether there are any bugs.

}

private boolean isEngineEndpointsChanged(Set<String> lastEngineEndpoints, Set<String> currentEngineEndpoints) {
if (lastEngineEndpoints == null || lastEngineEndpoints.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currentEngineEndpoints will null?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no

if (StringUtils.isEmpty(address)) {
address = registryName;
}
synchronized (LOCK) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

synchronized is not recommended now. It's not compatible with JDK21 virtual thread feature. Better to use 'ReentrantLock` or other mechanism. see https://openjdk.org/jeps/444

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

@chengyouling chengyouling merged commit 9b7f8e6 into apache:master Nov 24, 2025
5 checks passed
pem70 pushed a commit to pem70/servicecomb-java-chassis that referenced this pull request Nov 28, 2025
…ed when enabling RBAC authentication in a dual-engine disaster recovery scenario. (apache#5019)
pem70 pushed a commit to pem70/servicecomb-java-chassis that referenced this pull request Nov 28, 2025
…ed when enabling RBAC authentication in a dual-engine disaster recovery scenario. (apache#5019)
@chengyouling chengyouling deleted the master-auth branch January 6, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants