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 2021/03/17 18:40:45 UTC

[activemq-artemis] 01/03: ARTEMIS-3174: Set new connection on ServerSession during reattachment

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

commit 3b9008bda008ee8e7413c05c5c6238503d9a3bcc
Author: Markus Meierhofer <m....@incubedit.com>
AuthorDate: Thu Mar 11 11:35:19 2021 +0100

    ARTEMIS-3174: Set new connection on ServerSession during reattachment
    
    During session reattachment, also set the new connection on the
    "session" member of the ServerSessionPacketHandler. Until now,
    the connected ServerSessionImpl instance still referenced the old
    connection although it had already been transferred on the new connection.
---
 .../artemis/core/protocol/core/ServerSessionPacketHandler.java     | 2 ++
 .../org/apache/activemq/artemis/core/server/ServerSession.java     | 2 ++
 .../activemq/artemis/core/server/impl/ServerSessionImpl.java       | 7 ++++++-
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java
index 5ec11c5..d3b1909 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java
@@ -1018,6 +1018,8 @@ public class ServerSessionPacketHandler implements ChannelHandler {
 
       newConnection.syncIDGeneratorSequence(remotingConnection.getIDGeneratorSequence());
 
+      session.transferConnection(newConnection);
+
       Connection oldTransportConnection = remotingConnection.getTransportConnection();
 
       remotingConnection = newConnection;
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java
index b319cda..9be9412 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java
@@ -58,6 +58,8 @@ public interface ServerSession extends SecurityAuth {
    @Override
    RemotingConnection getRemotingConnection();
 
+   void transferConnection(RemotingConnection newConnection);
+
    Transaction newTransaction();
 
    boolean removeConsumer(long consumerID) throws Exception;
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
index dbc68f2..05d9eb8 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
@@ -136,7 +136,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
 
    protected final boolean strictUpdateDeliveryCount;
 
-   protected final RemotingConnection remotingConnection;
+   protected RemotingConnection remotingConnection;
 
    protected final Map<Long, ServerConsumer> consumers = new ConcurrentHashMap<>();
 
@@ -1074,6 +1074,11 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
    }
 
    @Override
+   public void transferConnection(RemotingConnection newConnection) {
+      remotingConnection = newConnection;
+   }
+
+   @Override
    public String getSecurityDomain() {
       return securityDomain;
    }