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:44 UTC

[activemq-artemis] branch master updated (cd44d90 -> 321802f)

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

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


    from cd44d90  This closes #3485
     new 3b9008b  ARTEMIS-3174: Set new connection on ServerSession during reattachment
     new d365253  ARTEMIS-3174 add test
     new 321802f  This closes #3486

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../protocol/core/ServerSessionPacketHandler.java  |  2 ++
 .../artemis/core/server/ServerSession.java         |  2 ++
 .../core/server/impl/ServerSessionImpl.java        |  7 +++++-
 .../integration/cluster/reattach/ReattachTest.java | 26 ++++++++++++++++++++++
 4 files changed, 36 insertions(+), 1 deletion(-)


[activemq-artemis] 02/03: ARTEMIS-3174 add test

Posted by jb...@apache.org.
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 d36525348db3884a4409f3032d283a8f1dfbcd02
Author: Justin Bertram <jb...@apache.org>
AuthorDate: Wed Mar 17 13:30:50 2021 -0500

    ARTEMIS-3174 add test
---
 .../integration/cluster/reattach/ReattachTest.java | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/ReattachTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/ReattachTest.java
index 3c91e7d..15bc091 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/ReattachTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/ReattachTest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.activemq.artemis.tests.integration.cluster.reattach;
 
+import java.util.Objects;
 import java.util.Timer;
 import java.util.TimerTask;
 import java.util.concurrent.CountDownLatch;
@@ -41,6 +42,7 @@ import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionPro
 import org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnector;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.api.core.RoutingType;
+import org.apache.activemq.artemis.core.server.ServerSession;
 import org.apache.activemq.artemis.jms.client.ActiveMQTextMessage;
 import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
@@ -122,6 +124,30 @@ public class ReattachTest extends ActiveMQTestBase {
       sf.close();
    }
 
+   @Test
+   public void testReattachTransferConnectionOnSession() throws Exception {
+      final long retryInterval = 50;
+      final double retryMultiplier = 1d;
+      final int reconnectAttempts = 10;
+
+      locator.setRetryInterval(retryInterval).setRetryIntervalMultiplier(retryMultiplier).setReconnectAttempts(reconnectAttempts).setConfirmationWindowSize(1024 * 1024);
+      ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal) createSessionFactory(locator);
+      ClientSession session = sf.createSession(false, true, true);
+
+      // there's only one session on the broker
+      Object originalConnectionID = ((ServerSession)server.getSessions().toArray()[0]).getConnectionID();
+
+      // trigger re-attach
+      ((ClientSessionInternal) session).getConnection().fail(new ActiveMQNotConnectedException());
+
+      session.start();
+
+      assertFalse(Objects.equals(((ServerSession)server.getSessions().toArray()[0]).getConnectionID(), originalConnectionID));
+
+      session.close();
+      sf.close();
+   }
+
    /*
     * Test failure on connection, but server is still up so should immediately reconnect
     */


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

Posted by jb...@apache.org.
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;
    }


[activemq-artemis] 03/03: This closes #3486

Posted by jb...@apache.org.
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 321802f52561ad91406297e63651c28dd51ff5c9
Merge: cd44d90 d365253
Author: Justin Bertram <jb...@apache.org>
AuthorDate: Wed Mar 17 13:36:09 2021 -0500

    This closes #3486

 .../protocol/core/ServerSessionPacketHandler.java  |  2 ++
 .../artemis/core/server/ServerSession.java         |  2 ++
 .../core/server/impl/ServerSessionImpl.java        |  7 +++++-
 .../integration/cluster/reattach/ReattachTest.java | 26 ++++++++++++++++++++++
 4 files changed, 36 insertions(+), 1 deletion(-)