Merge branch '3.2' into 3.3

This commit is contained in:
crazyhzm 2023-11-06 19:19:20 +08:00
commit 70469346b2
2 changed files with 11 additions and 3 deletions

View File

@ -114,7 +114,7 @@
<cxf_version>3.5.5</cxf_version>
<thrift_version>0.19.0</thrift_version>
<hessian_version>4.0.66</hessian_version>
<protobuf-java_version>3.24.4</protobuf-java_version>
<protobuf-java_version>3.25.0</protobuf-java_version>
<javax_annotation-api_version>1.3.2</javax_annotation-api_version>
<servlet_version>3.1.0</servlet_version>
<jetty_version>9.4.53.v20231009</jetty_version>

View File

@ -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