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 f288db5  Cancel keep-alive timer task after the proxy switch to TCP 
proxy (#1210)
f288db5 is described below

commit f288db58b45821ee7f5df2694eada6236afbe1a4
Author: Matteo Merli <mme...@apache.org>
AuthorDate: Fri Feb 9 13:02:28 2018 -0800

    Cancel keep-alive timer task after the proxy switch to TCP proxy (#1210)
---
 .../main/java/org/apache/pulsar/common/api/PulsarHandler.java | 11 ++++++++---
 .../java/org/apache/pulsar/proxy/server/ProxyConnection.java  |  1 +
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git 
a/pulsar-common/src/main/java/org/apache/pulsar/common/api/PulsarHandler.java 
b/pulsar-common/src/main/java/org/apache/pulsar/common/api/PulsarHandler.java
index 3d8e7ce..1094359 100644
--- 
a/pulsar-common/src/main/java/org/apache/pulsar/common/api/PulsarHandler.java
+++ 
b/pulsar-common/src/main/java/org/apache/pulsar/common/api/PulsarHandler.java
@@ -67,9 +67,7 @@ public abstract class PulsarHandler extends PulsarDecoder {
 
     @Override
     public void channelInactive(ChannelHandlerContext ctx) throws Exception {
-        if (keepAliveTask != null) {
-            keepAliveTask.cancel(false);
-        }
+        cancelKeepAliveTask();
     }
 
     @Override
@@ -113,6 +111,13 @@ public abstract class PulsarHandler extends PulsarDecoder {
         }
     }
 
+    protected void cancelKeepAliveTask() {
+        if (keepAliveTask != null) {
+            keepAliveTask.cancel(false);
+            keepAliveTask = null;
+        }
+    }
+
     /**
      * @return true if the connection is ready to use, meaning the Pulsar 
handshake was already completed
      */
diff --git 
a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java
 
b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java
index 921376f..68bd022 100644
--- 
a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java
+++ 
b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java
@@ -168,6 +168,7 @@ public class ProxyConnection extends PulsarHandler 
implements FutureListener<Voi
             // there and just pass bytes in both directions
             state = State.ProxyConnectionToBroker;
             directProxyHandler = new DirectProxyHandler(service, this, 
connect.getProxyToBrokerUrl());
+            cancelKeepAliveTask();
         } else {
             // Client is doing a lookup, we can consider the handshake 
complete and we'll take care of just topics and
             // partitions metadata lookups

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

Reply via email to