add service notification log

This commit is contained in:
ken.lj 2020-11-12 00:05:29 +08:00
parent 4ecb11b543
commit facc14e734
2 changed files with 8 additions and 1 deletions

View File

@ -101,6 +101,7 @@ public class ServiceDiscoveryRegistryDirectory<T> extends DynamicDirectory<T> im
Assert.notNull(invokerUrls, "invokerUrls should not be null, use empty url list to clear address.");
if (invokerUrls.size() == 0) {
logger.info("Received empty url list...");
this.forbidden = true; // Forbid to access
this.invokers = Collections.emptyList();
routerChain.setInvokers(this.invokers);
@ -115,6 +116,7 @@ public class ServiceDiscoveryRegistryDirectory<T> extends DynamicDirectory<T> im
}
Map<String, Invoker<T>> newUrlInvokerMap = toInvokers(invokerUrls);// Translate url list to Invoker map
logger.info("Refreshed invoker size " + newUrlInvokerMap.size());
if (CollectionUtils.isEmptyMap(newUrlInvokerMap)) {
logger.error(new IllegalStateException("Cannot create invokers from url address list (total " + invokerUrls.size() + ")"));
@ -253,6 +255,7 @@ public class ServiceDiscoveryRegistryDirectory<T> extends DynamicDirectory<T> im
}
if (deleted != null) {
logger.info(deleted.size() + " unused invokers deleted.");
for (String addressKey : deleted) {
if (addressKey != null) {
Invoker<T> invoker = oldUrlInvokerMap.remove(addressKey);

View File

@ -134,6 +134,8 @@ public class ServiceInstancesChangedListener implements ConditionalEventListener
}
}
logger.info(newRevisionToMetadata.size() + " unique revisions. ");
if (hasEmptyMetadata(newRevisionToMetadata)) {// retry every 10 seconds
if (retryPermission.tryAcquire()) {
scheduler.submit(new AddressRefreshRetryTask(retryPermission));
@ -304,7 +306,9 @@ public class ServiceInstancesChangedListener implements ConditionalEventListener
private void notifyAddressChanged() {
listeners.forEach((key, notifyListener) -> {
//FIXME, group wildcard match
notifyListener.notify(toUrlsWithEmpty(serviceUrls.get(key)));
List<URL> urls = toUrlsWithEmpty(serviceUrls.get(key));
logger.info("Notify service " + key + " with services " + urls.size());
notifyListener.notify(urls);
});
}