From e035487a5f352e5193d10dfa7f2fdb8f68e617bf Mon Sep 17 00:00:00 2001 From: Francesco Nigro Date: Tue, 19 Jun 2018 18:21:03 +0200 Subject: [PATCH] ARTEMIS-1945 InVMNodeManager shared state should be volatile State access should be atomic to be visibile between different threads. --- .../activemq/artemis/core/server/impl/InVMNodeManager.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/InVMNodeManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/InVMNodeManager.java index 2719d66c21..a3bce410e8 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/InVMNodeManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/InVMNodeManager.java @@ -49,7 +49,7 @@ public final class InVMNodeManager extends NodeManager { LIVE, PAUSED, FAILING_BACK, NOT_STARTED } - public State state = NOT_STARTED; + public volatile State state = NOT_STARTED; public long failoverPause = 0L; @@ -147,9 +147,7 @@ public final class InVMNodeManager extends NodeManager { @Override public void releaseBackup() { - if (backupLock != null) { - backupLock.release(); - } + backupLock.release(); } @Override