You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2018/03/06 21:33:16 UTC

[incubator-pulsar] branch master updated: Cleanup failed connection from background thread (#1345)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new da142eb  Cleanup failed connection from background thread (#1345)
da142eb is described below

commit da142eb839d6ffa384b4683de86c94056ad150aa
Author: Matteo Merli <mm...@apache.org>
AuthorDate: Tue Mar 6 13:33:14 2018 -0800

    Cleanup failed connection from background thread (#1345)
    
    This is a fix for #1138
---
 .../java/org/apache/pulsar/broker/service/ReplicatorTest.java    | 9 +--------
 .../main/java/org/apache/pulsar/client/impl/ConnectionPool.java  | 8 +++++---
 2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ReplicatorTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ReplicatorTest.java
index 3b3565f..799a07d 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ReplicatorTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ReplicatorTest.java
@@ -34,7 +34,6 @@ import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
-import java.util.concurrent.ForkJoinPool;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 
@@ -105,13 +104,7 @@ public class ReplicatorTest extends ReplicatorTestBase {
     @Override
     @AfterClass(timeOut = 30000)
     void shutdown() throws Exception {
-        ForkJoinPool.commonPool().execute(() -> {
-            try {
-                super.shutdown();
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        });
+        super.shutdown();
     }
 
     @DataProvider(name = "partitionedTopic")
diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConnectionPool.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConnectionPool.java
index 84edec1..52d85ca 100644
--- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConnectionPool.java
+++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConnectionPool.java
@@ -197,9 +197,11 @@ public class ConnectionPool implements Closeable {
                 return null;
             });
         }).exceptionally(exception -> {
-            log.warn("Failed to open connection to {} : {}", physicalAddress, exception.getClass().getSimpleName());
-            cnxFuture.completeExceptionally(new PulsarClientException(exception));
-            cleanupConnection(logicalAddress, connectionKey, cnxFuture);
+            eventLoopGroup.execute(() -> {
+                log.warn("Failed to open connection to {} : {}", physicalAddress, exception.getMessage());
+                cleanupConnection(logicalAddress, connectionKey, cnxFuture);
+                cnxFuture.completeExceptionally(new PulsarClientException(exception));
+            });
             return null;
         });
 

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