diff --git a/dubbo-dependencies-bom/pom.xml b/dubbo-dependencies-bom/pom.xml index 45d97ec1cc..f0fd107784 100644 --- a/dubbo-dependencies-bom/pom.xml +++ b/dubbo-dependencies-bom/pom.xml @@ -114,7 +114,7 @@ 3.5.5 0.19.0 4.0.66 - 3.24.4 + 3.25.0 1.3.2 3.1.0 9.4.53.v20231009 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 fe9296b8e3..ae60b913fa 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 @@ -27,6 +27,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_DELAY_EXECUTE_TIMES; +import static org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_FAILED_NOTIFY_EVENT; import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAILED_NOTIFY_EVENT; public abstract class RegistryNotifier { @@ -34,7 +35,7 @@ public abstract class RegistryNotifier { private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(RegistryNotifier.class); private volatile long lastExecuteTime; private volatile long lastEventTime; - + private final URL url; private Object rawAddresses; private long delayTime; @@ -50,6 +51,7 @@ public abstract class RegistryNotifier { } public RegistryNotifier(URL registryUrl, long delayTime, ScheduledExecutorService scheduler) { + this.url = registryUrl; this.delayTime = delayTime; if (scheduler == null) { this.scheduler = registryUrl.getOrDefaultFrameworkModel().getBeanFactory() @@ -68,7 +70,13 @@ public abstract class RegistryNotifier { // more than 10 calls && next execute time is in the future boolean delay = shouldDelay.get() && delta < 0; - if (delay) { + // when the scheduler is shutdown, no notification is sent + if (scheduler.isShutdown()) { + if (logger.isWarnEnabled()) { + logger.warn(COMMON_FAILED_NOTIFY_EVENT, "", "", "Notification scheduler is off, no notifications are sent. Registry URL: " + url); + } + return; + } else if (delay) { scheduler.schedule(new NotificationTask(this, notifyTime), -delta, TimeUnit.MILLISECONDS); } else { // check if more than 10 calls