ARTEMIS-3365 Fix NPE on CORE client disconnecting

This commit is contained in:
Domenico Francesco Bruscino 2021-08-06 18:43:41 +02:00
parent 8442c9b9d6
commit 9fd1d5941d
3 changed files with 7 additions and 7 deletions

View File

@ -21,8 +21,8 @@ public enum DisconnectReason {
REDIRECT_ON_CRITICAL_ERROR((byte)1, true),
SCALE_DOWN((byte)2, false),
SCALE_DOWN_ON_CRITICAL_ERROR((byte)3, true),
SHOUT_DOWN((byte)4, false),
SHOUT_DOWN_ON_CRITICAL_ERROR((byte)5, true);
SHUT_DOWN((byte)4, false),
SHUT_DOWN_ON_CRITICAL_ERROR((byte)5, true);
private final byte type;
private final boolean criticalError;
@ -49,7 +49,7 @@ public enum DisconnectReason {
}
public boolean isShutDown() {
return this == SHOUT_DOWN || this == SHOUT_DOWN_ON_CRITICAL_ERROR;
return this == SHUT_DOWN || this == SHUT_DOWN_ON_CRITICAL_ERROR;
}
public static DisconnectReason getType(byte type) {
@ -63,9 +63,9 @@ public enum DisconnectReason {
case 3:
return SCALE_DOWN_ON_CRITICAL_ERROR;
case 4:
return SHOUT_DOWN;
return SHUT_DOWN;
case 5:
return SHOUT_DOWN_ON_CRITICAL_ERROR;
return SHUT_DOWN_ON_CRITICAL_ERROR;
default:
return null;
}

View File

@ -473,7 +473,7 @@ public class ActiveMQClientProtocolManager implements ClientProtocolManager {
if (type == PacketImpl.DISCONNECT) {
final DisconnectMessage disMessage = (DisconnectMessage) packet;
handleDisconnect(disMessage.getNodeID(), null, null, null);
handleDisconnect(disMessage.getNodeID(), DisconnectReason.SHUT_DOWN, null, null);
} else if (type == PacketImpl.DISCONNECT_V2) {
final DisconnectMessage_V2 disMessage = (DisconnectMessage_V2) packet;
handleDisconnect(disMessage.getNodeID(), DisconnectReason.SCALE_DOWN, disMessage.getScaleDownNodeID(), null);

View File

@ -254,7 +254,7 @@ public class RemotingConnectionImpl extends AbstractRemotingConnection implement
@Override
public void disconnect(final boolean criticalError) {
disconnect(criticalError ? DisconnectReason.SHOUT_DOWN_ON_CRITICAL_ERROR : DisconnectReason.SHOUT_DOWN, null, null);
disconnect(criticalError ? DisconnectReason.SHUT_DOWN_ON_CRITICAL_ERROR : DisconnectReason.SHUT_DOWN, null, null);
}
@Override