ARTEMIS-4030 Fix SharedStoreLiveActivation race condition

DefaultCriticalErrorListener stops the server while SharedStoreLiveActivation
is initializing it.
This commit is contained in:
Domenico Francesco Bruscino 2022-10-07 09:09:07 +02:00 committed by Justin Bertram
parent 42529899d0
commit 3a5e4ce363
1 changed files with 10 additions and 8 deletions

View File

@ -85,16 +85,18 @@ public final class SharedStoreLiveActivation extends LiveActivation {
nodeManagerActivateCallback = activeMQServer.getNodeManager().startLiveNode(); nodeManagerActivateCallback = activeMQServer.getNodeManager().startLiveNode();
activeMQServer.registerActivateCallback(nodeManagerActivateCallback); activeMQServer.registerActivateCallback(nodeManagerActivateCallback);
if (activeMQServer.getState() == ActiveMQServerImpl.SERVER_STATE.STOPPED synchronized (activeMQServer) {
if (activeMQServer.getState() == ActiveMQServerImpl.SERVER_STATE.STOPPED
|| activeMQServer.getState() == ActiveMQServerImpl.SERVER_STATE.STOPPING) { || activeMQServer.getState() == ActiveMQServerImpl.SERVER_STATE.STOPPING) {
return; return;
}
activeMQServer.initialisePart2(false);
activeMQServer.completeActivation(false);
ActiveMQServerLogger.LOGGER.serverIsLive();
} }
activeMQServer.initialisePart2(false);
activeMQServer.completeActivation(false);
ActiveMQServerLogger.LOGGER.serverIsLive();
} catch (NodeManagerException nodeManagerException) { } catch (NodeManagerException nodeManagerException) {
if (nodeManagerException.getCause() instanceof ClosedChannelException) { if (nodeManagerException.getCause() instanceof ClosedChannelException) {
// this is ok, we are being stopped // this is ok, we are being stopped