You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/08/01 02:46:38 UTC

[dubbo] branch master updated: [Dubbo-8172]Not shuwdown ExecutorService when DefaultFuture. closeChannel() (#8188)

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

albumenj 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 9c49efe  [Dubbo-8172]Not shuwdown ExecutorService when DefaultFuture. closeChannel() (#8188)
9c49efe is described below

commit 9c49efeacfd87d2d4409fb000cebd58e1114ec8a
Author: 张远征hd <zh...@163.com>
AuthorDate: Sun Aug 1 10:45:59 2021 +0800

    [Dubbo-8172]Not shuwdown ExecutorService when DefaultFuture. closeChannel() (#8188)
    
    * fix 8172
    
    消费者端ExecutorService在运行期间不应该shutdown
    
    * add UT
---
 .../apache/dubbo/remoting/exchange/support/DefaultFuture.java |  5 -----
 .../dubbo/remoting/exchange/support/DefaultFutureTest.java    | 11 +++++++++++
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/DefaultFuture.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/DefaultFuture.java
index beddc2d..ffd8a9e 100644
--- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/DefaultFuture.java
+++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/DefaultFuture.java
@@ -142,11 +142,6 @@ public class DefaultFuture extends CompletableFuture<Object> {
             if (channel.equals(entry.getValue())) {
                 DefaultFuture future = getFuture(entry.getKey());
                 if (future != null && !future.isDone()) {
-                    ExecutorService futureExecutor = future.getExecutor();
-                    if (futureExecutor != null && !futureExecutor.isTerminated()) {
-                        futureExecutor.shutdownNow();
-                    }
-
                     Response disconnectResponse = new Response(future.getId());
                     disconnectResponse.setStatus(Response.CHANNEL_INACTIVE);
                     disconnectResponse.setErrorMessage("Channel " +
diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/DefaultFutureTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/DefaultFutureTest.java
index 67df3b9..f89c119 100644
--- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/DefaultFutureTest.java
+++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/DefaultFutureTest.java
@@ -158,6 +158,17 @@ public class DefaultFutureTest {
         Assertions.assertNull(future);
     }
 
+    @Test
+    public void testClose() throws Exception {
+        Channel channel = new MockedChannel();
+        Request request = new Request(123);
+        ExecutorService executor = ExtensionLoader.getExtensionLoader(ExecutorRepository.class)
+                .getDefaultExtension().createExecutorIfAbsent(URL.valueOf("dubbo://127.0.0.1:23456"));
+        DefaultFuture.newFuture(channel, request, 1000, executor);
+        DefaultFuture.closeChannel(channel);
+        Assertions.assertFalse(executor.isTerminated());
+    }
+
     /**
      * mock a default future
      */