You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by ts...@apache.org on 2020/06/18 12:37:01 UTC

[dubbo] branch master updated: [Dubbo-6340]fix application cannot exit when use consul registry (#6341)

This is an automated email from the ASF dual-hosted git repository.

tswstarplanet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/master by this push:
     new c4f11fc  [Dubbo-6340]fix application cannot exit when use consul registry (#6341)
c4f11fc is described below

commit c4f11fc25e7e11b29ca543cf691e4d084bb76cd5
Author: tswstarplanet <ts...@apache.org>
AuthorDate: Thu Jun 18 20:36:40 2020 +0800

    [Dubbo-6340]fix application cannot exit when use consul registry (#6341)
    
    * fix application cannot exit when use consul registry
---
 .../main/java/org/apache/dubbo/registry/consul/ConsulRegistry.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dubbo-registry/dubbo-registry-consul/src/main/java/org/apache/dubbo/registry/consul/ConsulRegistry.java b/dubbo-registry/dubbo-registry-consul/src/main/java/org/apache/dubbo/registry/consul/ConsulRegistry.java
index d649076..9593172 100644
--- a/dubbo-registry/dubbo-registry-consul/src/main/java/org/apache/dubbo/registry/consul/ConsulRegistry.java
+++ b/dubbo-registry/dubbo-registry-consul/src/main/java/org/apache/dubbo/registry/consul/ConsulRegistry.java
@@ -45,8 +45,8 @@ import java.util.Objects;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
@@ -86,7 +86,7 @@ public class ConsulRegistry extends FailbackRegistry {
         int port = url.getPort() != 0 ? url.getPort() : DEFAULT_PORT;
         client = new ConsulClient(host, port);
         checkPassInterval = url.getParameter(CHECK_PASS_INTERVAL, DEFAULT_CHECK_PASS_INTERVAL);
-        ttlConsulCheckExecutor = Executors.newSingleThreadScheduledExecutor();
+        ttlConsulCheckExecutor = new ScheduledThreadPoolExecutor(1, new NamedThreadFactory("Ttl-Consul-Check-Executor", true));
         ttlConsulCheckExecutor.scheduleAtFixedRate(this::checkPass, checkPassInterval / 8,
                 checkPassInterval / 8, TimeUnit.MILLISECONDS);
     }