You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2018/03/06 21:33:16 UTC
[GitHub] merlimat closed pull request #1345: Cleanup failed connection from background thread
merlimat closed pull request #1345: Cleanup failed connection from background thread
URL: https://github.com/apache/incubator-pulsar/pull/1345
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
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 3b3565feb..799a07d43 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.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 @@ void setup() throws Exception {
@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 84edec123..52d85ca4c 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 void initChannel(SocketChannel ch) throws Exception {
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;
});
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services