ARTEMIS-1253 Refactoring renaming stop(boolean) to fail(boolean)

This method name would clash with ServiceComponent
As the real meaning here on this method is just to failover
So I've renamed the method to avoid the clash with my next commit

(I've done this on a separate commit as you may need to redo this
 commit from scratch again in other branches instead of lots of clashes on cherry-pick)
This commit is contained in:
Clebert Suconic 2017-06-26 12:52:18 -04:00
parent 4bae814908
commit 36110da9c8
20 changed files with 29 additions and 29 deletions

View File

@ -2216,7 +2216,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
clearIO(); clearIO();
server.stop(true); server.fail(true);
} }
@Override @Override
@ -2251,7 +2251,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
liveOnlyPolicy.getScaleDownPolicy().getConnectors().add(0, connector); liveOnlyPolicy.getScaleDownPolicy().getConnectors().add(0, connector);
} }
server.stop(true); server.fail(true);
} }
} }

View File

@ -381,7 +381,7 @@ public interface ActiveMQServer extends ServiceComponent {
*/ */
boolean isAddressBound(String address) throws Exception; boolean isAddressBound(String address) throws Exception;
void stop(boolean failoverOnServerShutdown) throws Exception; void fail(boolean failoverOnServerShutdown) throws Exception;
Queue updateQueue(String name, Queue updateQueue(String name,
RoutingType routingType, RoutingType routingType,

View File

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

View File

@ -180,7 +180,7 @@ public class SharedNothingLiveActivation extends LiveActivation {
clusterConnection.addClusterTopologyListener(listener1); clusterConnection.addClusterTopologyListener(listener1);
if (listener1.waitForBackup()) { if (listener1.waitForBackup()) {
//if we have to many backups kept or are not configured to restart just stop, otherwise restart as a backup //if we have to many backups kept or are not configured to restart just stop, otherwise restart as a backup
activeMQServer.stop(true); activeMQServer.fail(true);
ActiveMQServerLogger.LOGGER.restartingReplicatedBackupAfterFailback(); ActiveMQServerLogger.LOGGER.restartingReplicatedBackupAfterFailback();
// activeMQServer.moveServerData(replicatedPolicy.getReplicaPolicy().getMaxSavedReplicatedJournalsSize()); // activeMQServer.moveServerData(replicatedPolicy.getReplicaPolicy().getMaxSavedReplicatedJournalsSize());
activeMQServer.setHAPolicy(replicatedPolicy.getReplicaPolicy()); activeMQServer.setHAPolicy(replicatedPolicy.getReplicaPolicy());

View File

@ -2358,7 +2358,7 @@ public abstract class ActiveMQTestBase extends Assert {
clusterManager.flushExecutor(); clusterManager.flushExecutor();
clusterManager.clear(); clusterManager.clear();
Assert.assertTrue("server should be running!", server.isStarted()); Assert.assertTrue("server should be running!", server.isStarted());
server.stop(true); server.fail(true);
if (sessions.length > 0) { if (sessions.length > 0) {
// Wait to be informed of failure // Wait to be informed of failure

View File

@ -71,7 +71,7 @@ public class BMFailoverTest extends FailoverTestBase {
public static void stopAndThrow() throws ActiveMQUnBlockedException { public static void stopAndThrow() throws ActiveMQUnBlockedException {
if (!stopped) { if (!stopped) {
try { try {
serverToStop.getServer().stop(true); serverToStop.getServer().fail(true);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -233,7 +233,7 @@ public class LargeMessageOverReplicationTest extends ActiveMQTestBase {
try { try {
if (messageChunkCount == 10) { if (messageChunkCount == 10) {
liveServer.stop(true); liveServer.fail(true);
System.err.println("activating"); System.err.println("activating");
if (!backupServer.waitForActivation(1, TimeUnit.MINUTES)) { if (!backupServer.waitForActivation(1, TimeUnit.MINUTES)) {

View File

@ -221,7 +221,7 @@ public class RaceOnSyncLargeMessageOverReplication2Test extends ActiveMQTestBase
waitForRemoteBackup(connection.getSessionFactory(), 30); waitForRemoteBackup(connection.getSessionFactory(), 30);
liveServer.stop(true); liveServer.fail(true);
Assert.assertTrue(failedOver.await(10, TimeUnit.SECONDS)); Assert.assertTrue(failedOver.await(10, TimeUnit.SECONDS));

View File

@ -200,7 +200,7 @@ public class RaceOnSyncLargeMessageOverReplicationTest extends ActiveMQTestBase
Assert.assertFalse(t.isAlive()); Assert.assertFalse(t.isAlive());
liveServer.stop(true); liveServer.fail(true);
Assert.assertTrue(failedOver.await(10, TimeUnit.SECONDS)); Assert.assertTrue(failedOver.await(10, TimeUnit.SECONDS));

View File

@ -92,7 +92,7 @@ public class StartStopDeadlockTest extends ActiveMQTestBase {
align.countDown(); align.countDown();
startLatch.await(); startLatch.await();
System.out.println("Crashing...."); System.out.println("Crashing....");
serverLive.stop(true); serverLive.fail(true);
} catch (Exception e) { } catch (Exception e) {
errors.incrementAndGet(); errors.incrementAndGet();
e.printStackTrace(); e.printStackTrace();

View File

@ -129,7 +129,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase {
// ((ServerSessionImpl) srvSession).clearLargeMessage(); // ((ServerSessionImpl) srvSession).clearLargeMessage();
// } // }
server.stop(false); server.fail(false);
ActiveMQTestBase.forceGC(); ActiveMQTestBase.forceGC();
@ -307,7 +307,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase {
session.rollback(); session.rollback();
} }
server.stop(false); server.fail(false);
server.start(); server.start();
server.stop(); server.stop();
@ -385,7 +385,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase {
sf.close(); sf.close();
} }
server.stop(false); server.fail(false);
server.start(); server.start();
validateNoFilesOnLargeDir(); validateNoFilesOnLargeDir();
@ -443,7 +443,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase {
session.close(); session.close();
sf.close(); sf.close();
server.stop(false); server.fail(false);
server.start(); server.start();
for (int start = 0; start < 2; start++) { for (int start = 0; start < 2; start++) {
@ -635,7 +635,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase {
} }
((ActiveMQServerImpl) server).replaceQueueFactory(original); ((ActiveMQServerImpl) server).replaceQueueFactory(original);
server.stop(false); server.fail(false);
server.start(); server.start();
server.stop(); server.stop();
@ -698,7 +698,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase {
} }
((ActiveMQServerImpl) server).replaceQueueFactory(original); ((ActiveMQServerImpl) server).replaceQueueFactory(original);
server.stop(false); server.fail(false);
server.start(); server.start();
server.stop(); server.stop();

View File

@ -155,7 +155,7 @@ public class BridgeReconnectTest extends BridgeTestBase {
startServers(); startServers();
waitForServerStart(server0); waitForServerStart(server0);
server0.stop(true); server0.fail(true);
waitForServerStart(server2); waitForServerStart(server2);
@ -206,7 +206,7 @@ public class BridgeReconnectTest extends BridgeTestBase {
BridgeReconnectTest.log.info("** failing connection"); BridgeReconnectTest.log.info("** failing connection");
// Now we will simulate a failure of the bridge connection between server0 and server1 // Now we will simulate a failure of the bridge connection between server0 and server1
server0.stop(true); server0.fail(true);
waitForServerStart(server2); waitForServerStart(server2);
@ -285,7 +285,7 @@ public class BridgeReconnectTest extends BridgeTestBase {
startServers(); startServers();
// Now we will simulate a failure of the bridge connection between server0 and server1 // Now we will simulate a failure of the bridge connection between server0 and server1
server0.stop(true); server0.fail(true);
locator = addServerLocator(ActiveMQClient.createServerLocatorWithHA(server2tc)).setReconnectAttempts(100); locator = addServerLocator(ActiveMQClient.createServerLocatorWithHA(server2tc)).setReconnectAttempts(100);
ClientSessionFactory csf0 = addSessionFactory(locator.createSessionFactory(server2tc)); ClientSessionFactory csf0 = addSessionFactory(locator.createSessionFactory(server2tc));

View File

@ -1455,7 +1455,7 @@ public class BridgeTest extends ActiveMQTestBase {
try { try {
System.out.println("Stopping server"); System.out.println("Stopping server");
latch.countDown(); latch.countDown();
serverToStop.stop(false); serverToStop.fail(false);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -93,7 +93,7 @@ public abstract class GroupingFailoverTestBase extends ClusterTestBase {
closeSessionFactory(0); closeSessionFactory(0);
servers[0].stop(true); servers[0].fail(true);
waitForServerRestart(2); waitForServerRestart(2);
@ -194,7 +194,7 @@ public abstract class GroupingFailoverTestBase extends ClusterTestBase {
closeSessionFactory(0); closeSessionFactory(0);
servers[0].stop(true); servers[0].fail(true);
waitForServerRestart(2); waitForServerRestart(2);

View File

@ -92,7 +92,7 @@ public class SameProcessActiveMQServer implements TestableServer {
clusterManager.flushExecutor(); clusterManager.flushExecutor();
clusterManager.clear(); clusterManager.clear();
Assert.assertTrue("server should be running!", server.isStarted()); Assert.assertTrue("server should be running!", server.isStarted());
server.stop(failover); server.fail(failover);
if (waitFailure) { if (waitFailure) {
// Wait to be informed of failure // Wait to be informed of failure

View File

@ -220,7 +220,7 @@ public class ReplicationWithDivertTest extends ActiveMQTestBase {
} }
Assert.assertFalse(t.isAlive()); Assert.assertFalse(t.isAlive());
liveServer.stop(true); liveServer.fail(true);
Assert.assertTrue(failedOver.await(10, TimeUnit.SECONDS)); Assert.assertTrue(failedOver.await(10, TimeUnit.SECONDS));
{ {

View File

@ -257,7 +257,7 @@ public class JMSUtil {
ClusterManager clusterManager = server.getClusterManager(); ClusterManager clusterManager = server.getClusterManager();
clusterManager.clear(); clusterManager.clear();
server.stop(true); server.fail(true);
// Wait to be informed of failure // Wait to be informed of failure
boolean ok = latch.await(10000, TimeUnit.MILLISECONDS); boolean ok = latch.await(10000, TimeUnit.MILLISECONDS);

View File

@ -1886,7 +1886,7 @@ public class MQTTTest extends MQTTTestSupport {
connection1.connect(); connection1.connect();
connection1.publish(address, payload.getBytes(), QoS.AT_LEAST_ONCE, true); connection1.publish(address, payload.getBytes(), QoS.AT_LEAST_ONCE, true);
getServer().stop(false); getServer().fail(false);
getServer().start(); getServer().start();
waitForServerToStart(getServer()); waitForServerToStart(getServer());

View File

@ -73,7 +73,7 @@ public class PagingWithFailoverAndCountersTest extends ActiveMQTestBase {
if (inProcessBackup != null) { if (inProcessBackup != null) {
try { try {
inProcessBackup.getServer().stop(false); inProcessBackup.getServer().fail(false);
} catch (Throwable ignored) { } catch (Throwable ignored) {
ignored.printStackTrace(); ignored.printStackTrace();
} }

View File

@ -47,7 +47,7 @@ public class SimpleStartStopTest extends ActiveMQTestBase {
for (int i = 0; i < 50; i++) { for (int i = 0; i < 50; i++) {
server = createServer(true, false); server = createServer(true, false);
server.start(); server.start();
server.stop(false); server.fail(false);
} }
// There shouldn't be any error from starting / stopping the server // There shouldn't be any error from starting / stopping the server