You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/09/08 11:43:40 UTC
[dubbo] branch 3.0 updated: Add log output when notify error (#8729)
This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.0 by this push:
new d2937af Add log output when notify error (#8729)
d2937af is described below
commit d2937af0499221f33e32ebd9b0935049045aba55
Author: Albumen Kevin <jh...@gmail.com>
AuthorDate: Wed Sep 8 19:43:20 2021 +0800
Add log output when notify error (#8729)
---
.../org/apache/dubbo/registry/RegistryNotifier.java | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/RegistryNotifier.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/RegistryNotifier.java
index f1195ef..58ca018 100644
--- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/RegistryNotifier.java
+++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/RegistryNotifier.java
@@ -17,6 +17,8 @@
package org.apache.dubbo.registry;
import org.apache.dubbo.common.extension.ExtensionLoader;
+import org.apache.dubbo.common.logger.Logger;
+import org.apache.dubbo.common.logger.LoggerFactory;
import org.apache.dubbo.common.threadpool.manager.ExecutorRepository;
import java.util.concurrent.ScheduledExecutorService;
@@ -26,6 +28,7 @@ import java.util.concurrent.atomic.AtomicInteger;
public abstract class RegistryNotifier {
+ private static final Logger logger = LoggerFactory.getLogger(RegistryNotifier.class);
private volatile long lastExecuteTime;
private volatile long lastEventTime;
@@ -90,14 +93,18 @@ public abstract class RegistryNotifier {
@Override
public void run() {
- if (this.time == listener.lastEventTime) {
- listener.doNotify(listener.rawAddresses);
- listener.lastExecuteTime = System.currentTimeMillis();
- synchronized (listener) {
- if (this.time == listener.lastEventTime) {
- listener.rawAddresses = null;
+ try {
+ if (this.time == listener.lastEventTime) {
+ listener.doNotify(listener.rawAddresses);
+ listener.lastExecuteTime = System.currentTimeMillis();
+ synchronized (listener) {
+ if (this.time == listener.lastEventTime) {
+ listener.rawAddresses = null;
+ }
}
}
+ } catch (Throwable t) {
+ logger.error("Error occurred when notify directory. ", t);
}
}
}