You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jb...@apache.org on 2020/06/24 18:34:56 UTC

[activemq-artemis] branch master updated: ARTEMIS-2821 Stop the timeout future when channel is closed

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

jbertram pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/master by this push:
     new 5621c40  ARTEMIS-2821 Stop the timeout future when channel is closed
     new f848fea  This closes #3196
5621c40 is described below

commit 5621c403ad625c9829afbc4d52a8e758cd7a7a61
Author: Bas Elzinga <b....@emagiz.com>
AuthorDate: Wed Feb 5 14:45:40 2020 +0100

    ARTEMIS-2821 Stop the timeout future when channel is closed
---
 .../activemq/artemis/core/protocol/ProtocolHandler.java       | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ProtocolHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ProtocolHandler.java
index c12aa5a..ed80fd3 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ProtocolHandler.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ProtocolHandler.java
@@ -101,7 +101,7 @@ public class ProtocolHandler {
 
       private final boolean httpEnabled;
 
-      private ScheduledFuture timeoutFuture;
+      private ScheduledFuture<?> timeoutFuture;
 
       private int handshakeTimeout;
 
@@ -123,6 +123,15 @@ public class ProtocolHandler {
       }
 
       @Override
+      public void channelInactive(ChannelHandlerContext ctx) throws Exception {
+         super.channelInactive(ctx);
+         if (handshakeTimeout > 0 && timeoutFuture != null) {
+            timeoutFuture.cancel(true);
+            timeoutFuture = null;
+         }
+      }
+
+      @Override
       public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
          if (msg instanceof FullHttpRequest) {
             FullHttpRequest request = (FullHttpRequest) msg;