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 2019/01/25 00:39:29 UTC
[pulsar] branch master updated: Cancel timeout timer in ClientCnx
(#3422)
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/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 14390da Cancel timeout timer in ClientCnx (#3422)
14390da is described below
commit 14390dad7d6dbbc9097efd062429238630905bbc
Author: Matteo Merli <mm...@apache.org>
AuthorDate: Thu Jan 24 16:39:24 2019 -0800
Cancel timeout timer in ClientCnx (#3422)
---
.../src/main/java/org/apache/pulsar/client/impl/ClientCnx.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java
index 709a45a..bb8b98d 100644
--- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java
+++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java
@@ -29,6 +29,7 @@ import java.util.Optional;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
@@ -122,6 +123,8 @@ public class ClientCnx extends PulsarHandler {
private boolean isTlsHostnameVerificationEnable;
private DefaultHostnameVerifier hostnameVerifier;
+ private final ScheduledFuture<?> timeoutTask;
+
enum State {
None, SentConnectFrame, Ready, Failed
}
@@ -155,7 +158,8 @@ public class ClientCnx extends PulsarHandler {
this.isTlsHostnameVerificationEnable = conf.isTlsHostnameVerificationEnable();
this.hostnameVerifier = new DefaultHostnameVerifier();
this.protocolVersion = protocolVersion;
- this.eventLoopGroup.scheduleAtFixedRate(() -> checkRequestTimeout(), operationTimeoutMs, operationTimeoutMs, TimeUnit.MILLISECONDS);
+ this.timeoutTask = this.eventLoopGroup.scheduleAtFixedRate(() -> checkRequestTimeout(), operationTimeoutMs,
+ operationTimeoutMs, TimeUnit.MILLISECONDS);
}
@Override
@@ -223,6 +227,8 @@ public class ClientCnx extends PulsarHandler {
producers.clear();
consumers.clear();
+
+ timeoutTask.cancel(true);
}
// Command Handlers