Enhance application-level registry notify message (#13172)

* Enhance application-level registry notify message

* Recovery complete message, because it works in single thread.
This commit is contained in:
TomlongTK 2023-10-10 10:06:18 +08:00 committed by GitHub
parent 5bef1fef65
commit a45f50d8ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -289,7 +289,7 @@ public class ServiceDiscoveryRegistryDirectory<T> extends DynamicDirectory<T> {
this.originalUrls = invokerUrls;
if (invokerUrls.size() == 1 && EMPTY_PROTOCOL.equals(invokerUrls.get(0).getProtocol())) {
logger.warn(PROTOCOL_UNSUPPORTED, "", "", "Received url with EMPTY protocol, will clear all available addresses.");
logger.warn(PROTOCOL_UNSUPPORTED, "", "", String.format("Received url with EMPTY protocol from registry %s, will clear all available addresses.", this));
refreshRouter(BitList.emptyList(), () ->
this.forbidden = true // Forbid to access
);
@ -297,7 +297,7 @@ public class ServiceDiscoveryRegistryDirectory<T> extends DynamicDirectory<T> {
} else {
this.forbidden = false; // Allow accessing
if (CollectionUtils.isEmpty(invokerUrls)) {
logger.warn(PROTOCOL_UNSUPPORTED, "", "", "Received empty url list, will ignore for protection purpose.");
logger.warn(PROTOCOL_UNSUPPORTED, "", "", String.format("Received empty url list from registry %s, will ignore for protection purpose.", this));
return;
}
@ -311,10 +311,10 @@ public class ServiceDiscoveryRegistryDirectory<T> extends DynamicDirectory<T> {
localUrlInvokerMap.forEach(oldUrlInvokerMap::put);
}
Map<ProtocolServiceKeyWithAddress, Invoker<T>> newUrlInvokerMap = toInvokers(oldUrlInvokerMap, invokerUrls);// Translate url list to Invoker map
logger.info("Refreshed invoker size " + newUrlInvokerMap.size());
logger.info(String.format("Refreshed invoker size %s from registry %s", newUrlInvokerMap.size(), this));
if (CollectionUtils.isEmptyMap(newUrlInvokerMap)) {
logger.error(PROTOCOL_UNSUPPORTED, "", "", "Unsupported protocol.", new IllegalStateException("Cannot create invokers from url address list (total " + invokerUrls.size() + ")"));
logger.error(PROTOCOL_UNSUPPORTED, "", "", "Unsupported protocol.", new IllegalStateException(String.format("Cannot create invokers from url address list (total %s)", invokerUrls.size())));
return;
}
List<Invoker<T>> newInvokers = Collections.unmodifiableList(new ArrayList<>(newUrlInvokerMap.values()));