ARTEMIS-1440 ForceFailover to be asynchronous and allow management

This commit is contained in:
Clebert Suconic 2017-09-28 21:35:05 -04:00
parent fbfab35412
commit 1b0fc06196
4 changed files with 15 additions and 9 deletions

View File

@ -118,9 +118,11 @@ import org.apache.activemq.artemis.utils.JsonLoader;
import org.apache.activemq.artemis.utils.ListUtil;
import org.apache.activemq.artemis.utils.SecurityFormatter;
import org.apache.activemq.artemis.utils.collections.TypedProperties;
import org.jboss.logging.Logger;
public class ActiveMQServerControlImpl extends AbstractControl implements ActiveMQServerControl, NotificationEmitter, org.apache.activemq.artemis.core.server.management.NotificationListener {
// Constants -----------------------------------------------------
private static final Logger logger = Logger.getLogger(ActiveMQServerControlImpl.class);
// Attributes ----------------------------------------------------
@ -2436,7 +2438,17 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
clearIO();
server.fail(true);
Thread t = new Thread() {
@Override
public void run() {
try {
server.fail(true);
} catch (Throwable e) {
logger.warn(e.getMessage(), e);
}
}
};
t.start();
}
@Override

View File

@ -941,7 +941,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
@Override
public final void fail(boolean failoverOnServerShutdown) throws Exception {
stop(failoverOnServerShutdown, false, false, false);
stop(failoverOnServerShutdown, false, false, true);
}
public final void stop(boolean failoverOnServerShutdown, boolean isExit) throws Exception {

View File

@ -1023,6 +1023,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
fail(e.getMessage());
}
}
Wait.waitFor(() -> !server.isStarted());
assertFalse(server.isStarted());
}

View File

@ -48,13 +48,6 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes
}
// it doesn't make sense through the core
// the pool will be shutdown while a connection is being used
// makes no sense!
@Override
public void testForceFailover() throws Exception {
}
@Override
protected ActiveMQServerControl createManagementControl() throws Exception {