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 f886c0bdb4)
This commit is contained in:
Francesco Nigro 2018-05-22 09:35:48 +02:00
parent b1538e7c48
commit 6b5f9d943c
2 changed files with 4 additions and 4 deletions

View File

@ -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");
}

View File

@ -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();
}