activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [activemq-artemis] branch master updated: ARTEMIS-2333 Applying proper fix on Stomp delivery
Date Wed, 08 May 2019 22:26:36 GMT
This is an automated email from the ASF dual-hosted git repository.

clebertsuconic 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 408cd37  ARTEMIS-2333 Applying proper fix on Stomp delivery
     new 3f08e7f  This closes #2664
408cd37 is described below

commit 408cd3745c633d6b54bfcafe5373251b183696aa
Author: Clebert Suconic <clebertsuconic@apache.org>
AuthorDate: Wed May 8 18:16:22 2019 -0400

    ARTEMIS-2333 Applying proper fix on Stomp delivery
    
    When connection is dead, the StompSession may deliver a message and if AUTO-ACK it would
ack and lose the message
---
 .../activemq/artemis/core/remoting/impl/netty/NettyConnection.java | 7 ++++++-
 .../org/apache/activemq/artemis/spi/core/remoting/Connection.java  | 2 ++
 .../activemq/artemis/core/protocol/core/impl/ChannelImplTest.java  | 5 +++++
 .../activemq/artemis/core/protocol/stomp/StompConnection.java      | 2 +-
 .../activemq/artemis/core/remoting/impl/invm/InVMConnection.java   | 5 +++++
 5 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java
index 8029931..51330c7 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java
@@ -137,11 +137,16 @@ public class NettyConnection implements Connection {
             readyListeners.add(callback);
          }
 
-         return ready && channel.isOpen();
+         return ready;
       }
    }
 
    @Override
+   public boolean isOpen() {
+      return channel.isOpen();
+   }
+
+   @Override
    public final void fireReady(final boolean ready) {
       ArrayList<ReadyListener> readyToCall = localListenersPool.get();
       if (readyToCall != null) {
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/Connection.java
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/Connection.java
index 0683a50..ebde456 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/Connection.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/Connection.java
@@ -43,6 +43,8 @@ public interface Connection {
 
    boolean isWritable(ReadyListener listener);
 
+   boolean isOpen();
+
    /**
     * Causes the current thread to wait until the connection can enqueue the required capacity
unless the specified waiting time elapses.
     * The available capacity of the connection could change concurrently hence this method
is suitable to perform precise flow-control
diff --git a/artemis-core-client/src/test/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImplTest.java
b/artemis-core-client/src/test/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImplTest.java
index 3f6bdca..9908d97 100644
--- a/artemis-core-client/src/test/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImplTest.java
+++ b/artemis-core-client/src/test/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImplTest.java
@@ -344,6 +344,11 @@ public class ChannelImplTest {
             }
 
             @Override
+            public boolean isOpen() {
+               return true;
+            }
+
+            @Override
             public boolean isWritable(ReadyListener listener) {
                return false;
             }
diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
index 92b6edc..8c32281 100644
--- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
+++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
@@ -153,7 +153,7 @@ public final class StompConnection implements RemotingConnection {
 
    @Override
    public boolean isWritable(ReadyListener callback) {
-      return transportConnection.isWritable(callback);
+      return transportConnection.isWritable(callback) && transportConnection.isOpen();
    }
 
    public boolean hasBytes() {
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnection.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnection.java
index ba4b997..b2fc576 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnection.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnection.java
@@ -117,6 +117,11 @@ public class InVMConnection implements Connection {
    }
 
    @Override
+   public boolean isOpen() {
+      return true;
+   }
+
+   @Override
    public void fireReady(boolean ready) {
    }
 


Mime
View raw message