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()); newConnection.syncIDGeneratorSequence(remotingConnection.getIDGeneratorSequence());
session.transferConnection(newConnection);
Connection oldTransportConnection = remotingConnection.getTransportConnection(); Connection oldTransportConnection = remotingConnection.getTransportConnection();
remotingConnection = newConnection; remotingConnection = newConnection;

View File

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

View File

@ -136,7 +136,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
protected final boolean strictUpdateDeliveryCount; protected final boolean strictUpdateDeliveryCount;
protected final RemotingConnection remotingConnection; protected RemotingConnection remotingConnection;
protected final Map<Long, ServerConsumer> consumers = new ConcurrentHashMap<>(); protected final Map<Long, ServerConsumer> consumers = new ConcurrentHashMap<>();
@ -1073,6 +1073,11 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
return remotingConnection; return remotingConnection;
} }
@Override
public void transferConnection(RemotingConnection newConnection) {
remotingConnection = newConnection;
}
@Override @Override
public String getSecurityDomain() { public String getSecurityDomain() {
return securityDomain; return securityDomain;