From 6b5f9d943c37e169e4b5b7b14914bfde2fa38c5b Mon Sep 17 00:00:00 2001 From: Francesco Nigro Date: Tue, 22 May 2018 09:35:48 +0200 Subject: [PATCH] ARTEMIS-1876 InVMNodeManager shouldn't be used if no JDBC HA is configured When database persistence and no shared store option is being used, Artemis is choosing to use InVMNodeManager, that is not providing the same behaviour of FileLockNodeManager. (cherry picked from commit f886c0bdb451c947143fba6cf07cbf8ce7f3ff4d) --- .../activemq/artemis/core/server/impl/ActiveMQServerImpl.java | 4 ++-- .../artemis/core/config/impl/HAPolicyConfigurationTest.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java index 7d8a956df5..faf6e0bf32 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java @@ -461,10 +461,10 @@ public class ActiveMQServerImpl implements ActiveMQServer { manager = JdbcNodeManager.with(dbConf, scheduledPool, executorFactory, shutdownOnCriticalIO); } else if (haType == null || haType == HAPolicyConfiguration.TYPE.LIVE_ONLY) { if (logger.isDebugEnabled()) { - logger.debug("Detected no Shared Store HA options on JDBC store: will use InVMNodeManager"); + logger.debug("Detected no Shared Store HA options on JDBC store"); } //LIVE_ONLY should be the default HA option when HA isn't configured - manager = new InVMNodeManager(replicatingBackup); + manager = new FileLockNodeManager(directory, replicatingBackup, configuration.getJournalLockAcquisitionTimeout()); } else { throw new IllegalArgumentException("JDBC persistence allows only Shared Store HA options"); } diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/HAPolicyConfigurationTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/HAPolicyConfigurationTest.java index 4d9bf75ea4..2a236134a2 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/HAPolicyConfigurationTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/HAPolicyConfigurationTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreSlavePolicy import org.apache.activemq.artemis.core.server.impl.Activation; import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; import org.apache.activemq.artemis.core.server.impl.ColocatedActivation; -import org.apache.activemq.artemis.core.server.impl.InVMNodeManager; +import org.apache.activemq.artemis.core.server.impl.FileLockNodeManager; import org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation; import org.apache.activemq.artemis.core.server.impl.SharedNothingBackupActivation; import org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation; @@ -54,7 +54,7 @@ public class HAPolicyConfigurationTest extends ActiveMQTestBase { assertEquals(HAPolicyConfiguration.TYPE.LIVE_ONLY, server.getConfiguration().getHAPolicyConfiguration().getType()); try { server.start(); - assertThat(server.getNodeManager(), instanceOf(InVMNodeManager.class)); + assertThat(server.getNodeManager(), instanceOf(FileLockNodeManager.class)); } finally { server.stop(); }