This closes #3090
This commit is contained in:
commit
85f26ce147
|
@ -92,6 +92,9 @@ public class ClusterController implements ActiveMQComponent {
|
|||
|
||||
@Override
|
||||
public void start() throws Exception {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Starting Cluster Controller " + System.identityHashCode(this) + " for server " + server);
|
||||
}
|
||||
if (started)
|
||||
return;
|
||||
//set the default locator that will be used to connecting to the default cluster.
|
||||
|
@ -129,13 +132,17 @@ public class ClusterController implements ActiveMQComponent {
|
|||
|
||||
@Override
|
||||
public void stop() throws Exception {
|
||||
if (logger.isDebugEnabled()) {
|
||||
|
||||
logger.debug("Stopping Cluster Controller " + System.identityHashCode(this) + " for server " + this.server);
|
||||
}
|
||||
started = false;
|
||||
//close all the locators
|
||||
for (ServerLocatorInternal serverLocatorInternal : locators.values()) {
|
||||
serverLocatorInternal.close();
|
||||
}
|
||||
//stop the quorum manager
|
||||
quorumManager.stop();
|
||||
started = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -428,14 +435,20 @@ public class ClusterController implements ActiveMQComponent {
|
|||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
serverLocator.connect();
|
||||
if (serverLocator == replicationLocator) {
|
||||
replicationClusterConnectedLatch.countDown();
|
||||
if (started) {
|
||||
serverLocator.connect();
|
||||
if (serverLocator == replicationLocator) {
|
||||
replicationClusterConnectedLatch.countDown();
|
||||
}
|
||||
}
|
||||
} catch (ActiveMQException e) {
|
||||
if (!started) {
|
||||
return;
|
||||
}
|
||||
if (logger.isDebugEnabled()) {
|
||||
|
||||
logger.debug("retry on Cluster Controller " + System.identityHashCode(ClusterController.this) + " server = " + server);
|
||||
}
|
||||
server.getScheduledPool().schedule(this, serverLocator.getRetryInterval(), TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1059,7 +1059,9 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
*/
|
||||
void stop(boolean failoverOnServerShutdown, final boolean criticalIOError, boolean restarting, boolean isShutdown) {
|
||||
|
||||
logger.debug("Stopping server");
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Stopping server " + this);
|
||||
}
|
||||
|
||||
synchronized (this) {
|
||||
if (state == SERVER_STATE.STOPPED || state == SERVER_STATE.STOPPING) {
|
||||
|
@ -3899,7 +3901,9 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
public void run() {
|
||||
lockActivation();
|
||||
try {
|
||||
runnable.run();
|
||||
if (state != SERVER_STATE.STOPPED && state != SERVER_STATE.STOPPING) {
|
||||
runnable.run();
|
||||
}
|
||||
} finally {
|
||||
unlockActivation();
|
||||
}
|
||||
|
|
|
@ -275,8 +275,11 @@ public final class SharedNothingBackupActivation extends Activation {
|
|||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Calling activeMQServer.stop() and start() to restart the server");
|
||||
}
|
||||
activeMQServer.stop();
|
||||
activeMQServer.start();
|
||||
if (activeMQServer.getState() != ActiveMQServer.SERVER_STATE.STOPPED &&
|
||||
activeMQServer.getState() != ActiveMQServer.SERVER_STATE.STOPPING) {
|
||||
activeMQServer.stop();
|
||||
activeMQServer.start();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ActiveMQServerLogger.LOGGER.errorRestartingBackupServer(e, activeMQServer);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,8 @@ public class BackupAuthenticationTest extends FailoverTestBase {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testPasswordSetting() throws Exception {
|
||||
public void testWrongPasswordSetting() throws Exception {
|
||||
Wait.assertTrue(liveServer.getServer()::isActive);
|
||||
waitForServerToStart(liveServer.getServer());
|
||||
backupServer.start();
|
||||
assertTrue(latch.await(5, TimeUnit.SECONDS));
|
||||
|
@ -54,9 +55,8 @@ public class BackupAuthenticationTest extends FailoverTestBase {
|
|||
*/
|
||||
Wait.waitFor(() -> !backupServer.isStarted());
|
||||
assertFalse("backup should have stopped", backupServer.isStarted());
|
||||
backupConfig.setClusterPassword(CLUSTER_PASSWORD);
|
||||
backupServer.start();
|
||||
waitForRemoteBackup(null, 5, true, backupServer.getServer());
|
||||
backupServer.stop();
|
||||
liveServer.stop();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue