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.
This commit is contained in:
Markus Meierhofer 2021-03-11 11:35:19 +01:00 committed by Justin Bertram
parent cd44d90f2b
commit 3b9008bda0
3 changed files with 10 additions and 1 deletions

View File

@ -1018,6 +1018,8 @@ public class ServerSessionPacketHandler implements ChannelHandler {
newConnection.syncIDGeneratorSequence(remotingConnection.getIDGeneratorSequence());
session.transferConnection(newConnection);
Connection oldTransportConnection = remotingConnection.getTransportConnection();
remotingConnection = newConnection;

View File

@ -58,6 +58,8 @@ public interface ServerSession extends SecurityAuth {
@Override
RemotingConnection getRemotingConnection();
void transferConnection(RemotingConnection newConnection);
Transaction newTransaction();
boolean removeConsumer(long consumerID) throws Exception;

View File

@ -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<>();
@ -1073,6 +1073,11 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
return remotingConnection;
}
@Override
public void transferConnection(RemotingConnection newConnection) {
remotingConnection = newConnection;
}
@Override
public String getSecurityDomain() {
return securityDomain;