diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/Constants.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/Constants.java index d21534436c4..18eba314c83 100644 --- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/Constants.java +++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/Constants.java @@ -66,9 +66,9 @@ public interface Constants { int DEFAULT_SESSION_TIMEOUT = 60 * 1000; /** - * Default value for the times of retry: 3 + * Default value for the times of retry: -1 (forever) */ - int DEFAULT_REGISTRY_RETRY_TIMES = 3; + int DEFAULT_REGISTRY_RETRY_TIMES = -1; int DEFAULT_REGISTRY_RECONNECT_PERIOD = 3 * 1000; diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/retry/AbstractRetryTask.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/retry/AbstractRetryTask.java index 425430b1340..c6226db1327 100644 --- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/retry/AbstractRetryTask.java +++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/retry/AbstractRetryTask.java @@ -113,7 +113,7 @@ public void run(Timeout timeout) throws Exception { // other thread cancel this timeout or stop the timer. return; } - if (times > retryTimes) { + if (retryTimes > 0 && times > retryTimes) { // 1-13 - failed to execute the retrying task. logger.warn(