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

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


The following commit(s) were added to refs/heads/master by this push:
     new 0592e84  Fix isShutdown() always return true (#1426)
0592e84 is described below

commit 0592e84a3c07b4451e81d2eecc0c51af384858d2
Author: ma-xiao-guang-64 <m...@maxiaoguang.com>
AuthorDate: Wed May 9 11:00:32 2018 +0800

    Fix isShutdown() always return true (#1426)
---
 .../java/com/alibaba/dubbo/common/utils/ExecutorUtil.java  | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git 
a/dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/ExecutorUtil.java 
b/dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/ExecutorUtil.java
index 19d581f..6b07cc8 100644
--- 
a/dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/ExecutorUtil.java
+++ 
b/dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/ExecutorUtil.java
@@ -34,9 +34,9 @@ public class ExecutorUtil {
             new LinkedBlockingQueue<Runnable>(100),
             new NamedThreadFactory("Close-ExecutorService-Timer", true));
 
-    public static boolean isShutdown(Executor executor) {
+    public static boolean isTerminated(Executor executor) {
         if (executor instanceof ExecutorService) {
-            if (((ExecutorService) executor).isShutdown()) {
+            if (((ExecutorService) executor).isTerminated()) {
                 return true;
             }
         }
@@ -44,7 +44,7 @@ public class ExecutorUtil {
     }
 
     public static void gracefulShutdown(Executor executor, int timeout) {
-        if (!(executor instanceof ExecutorService) || isShutdown(executor)) {
+        if (!(executor instanceof ExecutorService) || isTerminated(executor)) {
             return;
         }
         final ExecutorService es = (ExecutorService) executor;
@@ -63,13 +63,13 @@ public class ExecutorUtil {
             es.shutdownNow();
             Thread.currentThread().interrupt();
         }
-        if (!isShutdown(es)) {
+        if (!isTerminated(es)) {
             newThreadToCloseExecutor(es);
         }
     }
 
     public static void shutdownNow(Executor executor, final int timeout) {
-        if (!(executor instanceof ExecutorService) || isShutdown(executor)) {
+        if (!(executor instanceof ExecutorService) || isTerminated(executor)) {
             return;
         }
         final ExecutorService es = (ExecutorService) executor;
@@ -85,13 +85,13 @@ public class ExecutorUtil {
         } catch (InterruptedException ex) {
             Thread.currentThread().interrupt();
         }
-        if (!isShutdown(es)) {
+        if (!isTerminated(es)) {
             newThreadToCloseExecutor(es);
         }
     }
 
     private static void newThreadToCloseExecutor(final ExecutorService es) {
-        if (!isShutdown(es)) {
+        if (!isTerminated(es)) {
             shutdownExecutor.execute(new Runnable() {
                 @Override
                 public void run() {

-- 
To stop receiving notification emails like this one, please contact
hux...@apache.org.

Reply via email to