You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2017/06/27 16:19:52 UTC

[1/4] activemq-artemis git commit: ARTEMIS-1253 Fixing NetworkHealthCheck being shutdown after failures

Repository: activemq-artemis
Updated Branches:
  refs/heads/master 8a8023bf0 -> 4d6956c29


ARTEMIS-1253 Fixing NetworkHealthCheck being shutdown after failures


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/f407d86f
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/f407d86f
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/f407d86f

Branch: refs/heads/master
Commit: f407d86f0fd8d8472600364caf88e1711c0e4e0b
Parents: 36110da
Author: Clebert Suconic <cl...@apache.org>
Authored: Mon Jun 26 13:13:43 2017 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon Jun 26 16:15:39 2017 -0400

----------------------------------------------------------------------
 .../activemq/artemis/cli/commands/Run.java      |  4 ++--
 .../artemis/integration/FileBroker.java         | 12 ++++-------
 .../artemis/core/server/ServiceComponent.java   |  2 +-
 .../core/server/impl/ActiveMQServerImpl.java    | 22 ++++++++------------
 .../core/server/impl/EmbeddedServerTest.java    | 12 +++++++----
 .../artemis/component/WebServerComponent.java   |  4 ----
 6 files changed, 24 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f407d86f/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java
index e48a1f4..229bd5b 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java
@@ -122,7 +122,7 @@ public class Run extends LockAbstract {
             if (file.exists()) {
                try {
                   try {
-                     server.exit();
+                     server.stop(true);
                   } catch (Exception e) {
                      e.printStackTrace();
                   }
@@ -143,7 +143,7 @@ public class Run extends LockAbstract {
          @Override
          public void run() {
             try {
-               server.exit();
+               server.stop(true);
             } catch (Exception e) {
                e.printStackTrace();
             }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f407d86f/artemis-cli/src/main/java/org/apache/activemq/artemis/integration/FileBroker.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/integration/FileBroker.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/integration/FileBroker.java
index af2286f..744a0e6 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/integration/FileBroker.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/integration/FileBroker.java
@@ -124,23 +124,19 @@ public class FileBroker implements Broker {
 
    @Override
    public void stop() throws Exception {
-      stop(false);
-   }
-
-   @Override
-   public void exit() throws Exception {
       stop(true);
    }
 
-   private void stop(boolean isShutdown) throws Exception {
+   @Override
+   public void stop(boolean isShutdown) throws Exception {
       if (!started) {
          return;
       }
       ActiveMQComponent[] mqComponents = new ActiveMQComponent[components.size()];
       components.values().toArray(mqComponents);
       for (int i = mqComponents.length - 1; i >= 0; i--) {
-         if (mqComponents[i] instanceof ServiceComponent && isShutdown) {
-            ((ServiceComponent) mqComponents[i]).exit();
+         if (mqComponents[i] instanceof ServiceComponent) {
+            ((ServiceComponent) mqComponents[i]).stop(isShutdown);
          } else {
             mqComponents[i].stop();
          }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f407d86f/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/ServiceComponent.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/ServiceComponent.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/ServiceComponent.java
index 6c347dd..8ef1577 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/ServiceComponent.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/ServiceComponent.java
@@ -22,5 +22,5 @@ package org.apache.activemq.artemis.core.server;
 public interface ServiceComponent extends ActiveMQComponent {
 
    //called by shutdown hooks before exit the VM
-   void exit() throws Exception;
+   void stop(boolean shutdown) throws Exception;
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f407d86f/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
----------------------------------------------------------------------
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 6ab95ee..ba7bed0 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
@@ -340,7 +340,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
 
       @Override
       public void stop() throws Exception {
-         internalStop(false);
+         ActiveMQServerImpl.this.stop(false);
       }
 
       @Override
@@ -679,20 +679,16 @@ public class ActiveMQServerImpl implements ActiveMQServer {
    }
 
    @Override
-   public void exit() throws Exception {
-      internalStop(true);
+   public void stop() throws Exception {
+      stop(true);
    }
 
    @Override
-   public final void stop() throws Exception {
-      internalStop(false);
-   }
-
-   private void internalStop(boolean isExit) throws Exception {
+   public void stop(boolean isShutdown)  throws Exception {
       try {
-         stop(false, isExit);
+         stop(false, isShutdown);
       } finally {
-         networkHealthCheck.stop();
+         if (isShutdown) networkHealthCheck.stop();
       }
    }
 
@@ -866,7 +862,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
     *
     * @param criticalIOError whether we have encountered an IO error with the journal etc
     */
-   void stop(boolean failoverOnServerShutdown, final boolean criticalIOError, boolean restarting, boolean isExit) {
+   void stop(boolean failoverOnServerShutdown, final boolean criticalIOError, boolean restarting, boolean isShutdown) {
 
       synchronized (this) {
          if (state == SERVER_STATE.STOPPED || state == SERVER_STATE.STOPPING) {
@@ -1055,8 +1051,8 @@ public class ActiveMQServerImpl implements ActiveMQServer {
 
       for (ActiveMQComponent externalComponent : externalComponents) {
          try {
-            if (isExit && externalComponent instanceof ServiceComponent) {
-               ((ServiceComponent)externalComponent).exit();
+            if (externalComponent instanceof ServiceComponent) {
+               ((ServiceComponent)externalComponent).stop(isShutdown);
             } else {
                externalComponent.stop();
             }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f407d86f/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/EmbeddedServerTest.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/EmbeddedServerTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/EmbeddedServerTest.java
index e47440d..31b2626 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/EmbeddedServerTest.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/EmbeddedServerTest.java
@@ -81,7 +81,7 @@ public class EmbeddedServerTest {
       server.addExternalComponent(normalComponent);
       server.addExternalComponent(serviceComponent);
 
-      server.stop();
+      server.stop(false);
       assertTrue(normalComponent.stopCalled);
 
       assertTrue(serviceComponent.stopCalled);
@@ -91,7 +91,7 @@ public class EmbeddedServerTest {
       serviceComponent.resetFlags();
 
       server.start();
-      server.exit();
+      server.stop();
       assertTrue(normalComponent.stopCalled);
 
       assertFalse(serviceComponent.stopCalled);
@@ -129,8 +129,12 @@ public class EmbeddedServerTest {
       volatile boolean exitCalled;
 
       @Override
-      public void exit() throws Exception {
-         exitCalled = true;
+      public void stop(boolean isShutdown) throws Exception {
+         if (isShutdown) {
+            exitCalled = true;
+         } else {
+            stop();
+         }
       }
 
       @Override

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f407d86f/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java
----------------------------------------------------------------------
diff --git a/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java b/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java
index 6dce708..5ac42df 100644
--- a/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java
+++ b/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java
@@ -191,10 +191,6 @@ public class WebServerComponent implements ExternalComponent {
    }
 
    @Override
-   public void exit() throws Exception {
-      stop(true);
-   }
-
    public void stop(boolean isShutdown) throws Exception {
       if (isShutdown) {
          internalStop();


[4/4] activemq-artemis git commit: This closes #1367

Posted by cl...@apache.org.
This closes #1367


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/4d6956c2
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/4d6956c2
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/4d6956c2

Branch: refs/heads/master
Commit: 4d6956c291d6eb429abc3898c5273988dfb238a9
Parents: 8a8023b f407d86
Author: Clebert Suconic <cl...@apache.org>
Authored: Tue Jun 27 12:19:38 2017 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Tue Jun 27 12:19:38 2017 -0400

----------------------------------------------------------------------
 .../activemq/artemis/cli/commands/Run.java      |   4 +-
 .../artemis/integration/FileBroker.java         |  12 +-
 .../artemis/core/server/ServiceComponent.java   |   2 +-
 .../impl/ActiveMQServerControlImpl.java         |   4 +-
 .../artemis/core/server/ActiveMQServer.java     |   2 +-
 .../core/server/impl/ActiveMQServerImpl.java    |  24 +--
 .../impl/SharedNothingLiveActivation.java       |   2 +-
 .../core/server/impl/EmbeddedServerTest.java    |  12 +-
 .../artemis/tests/util/ActiveMQTestBase.java    |   2 +-
 .../artemis/component/WebServerComponent.java   |   4 -
 .../tests/extras/byteman/BMFailoverTest.java    |   2 +-
 .../LargeMessageOverReplicationTest.java        |   2 +-
 ...eOnSyncLargeMessageOverReplication2Test.java |   2 +-
 ...ceOnSyncLargeMessageOverReplicationTest.java |   2 +-
 .../extras/byteman/StartStopDeadlockTest.java   |   2 +-
 .../client/InterruptedLargeMessageTest.java     |  12 +-
 .../cluster/bridge/BridgeReconnectTest.java     |   6 +-
 .../integration/cluster/bridge/BridgeTest.java  |   2 +-
 .../failover/GroupingFailoverTestBase.java      |   4 +-
 .../NetworkIsolationReplicationTest.java        | 178 -----------------
 .../failover/NetworkReplicationTest.java        | 198 +++++++++++++++++++
 .../cluster/util/SameProcessActiveMQServer.java |   2 +-
 .../divert/ReplicationWithDivertTest.java       |   2 +-
 .../jms/server/management/JMSUtil.java          |   2 +-
 .../integration/mqtt/imported/MQTTTest.java     |   2 +-
 .../PagingWithFailoverAndCountersTest.java      |   2 +-
 .../integration/server/SimpleStartStopTest.java |   2 +-
 27 files changed, 251 insertions(+), 239 deletions(-)
----------------------------------------------------------------------



[3/4] activemq-artemis git commit: ARTEMIS-1253 Adding testcase

Posted by cl...@apache.org.
ARTEMIS-1253 Adding testcase


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/4bae8149
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/4bae8149
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/4bae8149

Branch: refs/heads/master
Commit: 4bae81490857f1ea292a89bead675669fae6de4e
Parents: 8a8023b
Author: Clebert Suconic <cl...@apache.org>
Authored: Mon Jun 26 11:05:33 2017 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon Jun 26 16:15:39 2017 -0400

----------------------------------------------------------------------
 .../NetworkIsolationReplicationTest.java        | 178 -----------------
 .../failover/NetworkReplicationTest.java        | 198 +++++++++++++++++++
 2 files changed, 198 insertions(+), 178 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/4bae8149/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NetworkIsolationReplicationTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NetworkIsolationReplicationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NetworkIsolationReplicationTest.java
deleted file mode 100644
index e179c21..0000000
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NetworkIsolationReplicationTest.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.activemq.artemis.tests.integration.cluster.failover;
-
-import java.net.InetAddress;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.activemq.artemis.api.core.TransportConfiguration;
-import org.apache.activemq.artemis.api.core.client.ClientSession;
-import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
-import org.apache.activemq.artemis.api.core.client.ServerLocator;
-import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
-import org.apache.activemq.artemis.tests.util.TransportConfigurationUtils;
-import org.jboss.logging.Logger;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-public class NetworkIsolationReplicationTest extends FailoverTestBase {
-
-   private static final Logger logger = Logger.getLogger(NetworkIsolationReplicationTest.class);
-
-   @Before
-   @Override
-   public void setUp() throws Exception {
-      this.startBackupServer = false;
-      super.setUp();
-   }
-
-   @Override
-   protected TransportConfiguration getAcceptorTransportConfiguration(final boolean live) {
-      return TransportConfigurationUtils.getNettyAcceptor(live, 1);
-   }
-
-   @Override
-   protected TransportConfiguration getConnectorTransportConfiguration(final boolean live) {
-      return TransportConfigurationUtils.getNettyConnector(live, 1);
-   }
-
-   protected ClientSession createSession(ClientSessionFactory sf1,
-                                         boolean xa,
-                                         boolean autoCommitSends,
-                                         boolean autoCommitAcks) throws Exception {
-      return addClientSession(sf1.createSession(xa, autoCommitSends, autoCommitAcks));
-   }
-
-   @Test
-   public void testDoNotActivateOnIsolation() throws Exception {
-      AssertionLoggerHandler.startCapture();
-
-      try {
-         ServerLocator locator = getServerLocator();
-
-         // this block here is just to validate if ignoring loopback addresses logic is in place
-         {
-            backupServer.getServer().getNetworkHealthCheck().addAddress(InetAddress.getByName("127.0.0.1"));
-
-            Assert.assertTrue(AssertionLoggerHandler.findText("AMQ202001"));
-
-            AssertionLoggerHandler.clear();
-
-            backupServer.getServer().getNetworkHealthCheck().setIgnoreLoopback(true).addAddress(InetAddress.getByName("127.0.0.1"));
-
-            Assert.assertFalse(AssertionLoggerHandler.findText("AMQ202001"));
-
-            backupServer.getServer().getNetworkHealthCheck().clearAddresses();
-         }
-
-         backupServer.getServer().getNetworkHealthCheck().addAddress(InetAddress.getByName("203.0.113.1"));
-         backupServer.getServer().start();
-
-         ClientSessionFactory sf = addSessionFactory(locator.createSessionFactory());
-
-         ClientSession session = createSession(sf, false, true, true);
-
-         session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
-
-         Assert.assertFalse(backupServer.getServer().getNetworkHealthCheck().check());
-
-         crash(false, true, session);
-
-         for (int i = 0; i < 1000 && !backupServer.isStarted(); i++) {
-            Thread.sleep(10);
-         }
-
-         Assert.assertTrue(backupServer.isStarted());
-         Assert.assertFalse(backupServer.isActive());
-
-         liveServer.start();
-
-         for (int i = 0; i < 1000 && backupServer.getServer().getReplicationEndpoint() != null && !backupServer.getServer().getReplicationEndpoint().isStarted(); i++) {
-            Thread.sleep(10);
-         }
-
-         backupServer.getServer().getNetworkHealthCheck().clearAddresses();
-
-         // This will make sure the backup got synchronized after the network was activated again
-         Assert.assertTrue(backupServer.getServer().getReplicationEndpoint().isStarted());
-      } finally {
-         AssertionLoggerHandler.stopCapture();
-      }
-   }
-
-   @Test
-   public void testLiveIsolated() throws Exception {
-      backupServer.stop();
-
-      liveServer.stop();
-      liveServer.getServer().getConfiguration().setNetworkCheckList("203.0.113.1").
-         setNetworkCheckPeriod(100).setNetworkCheckTimeout(100);
-
-      try {
-
-         liveServer.start();
-
-         Assert.assertEquals(100L, liveServer.getServer().getNetworkHealthCheck().getPeriod());
-
-         liveServer.getServer().getNetworkHealthCheck().setTimeUnit(TimeUnit.MILLISECONDS);
-
-         Assert.assertFalse(liveServer.getServer().getNetworkHealthCheck().check());
-
-         long timeout = System.currentTimeMillis() + 30000;
-         while (liveServer.isStarted() && System.currentTimeMillis() < timeout) {
-            Thread.sleep(100);
-         }
-
-         Assert.assertFalse(liveServer.isStarted());
-
-         liveServer.getServer().getNetworkHealthCheck().setIgnoreLoopback(true).addAddress(InetAddress.getByName("127.0.0.1"));
-
-         timeout = System.currentTimeMillis() + 30000;
-         while (!liveServer.isStarted() && System.currentTimeMillis() < timeout) {
-            Thread.sleep(100);
-         }
-
-         Assert.assertTrue(liveServer.isStarted());
-      } catch (Throwable e) {
-         logger.warn(e.getMessage(), e);
-         throw e;
-      } finally {
-         liveServer.getServer().stop();
-         backupServer.getServer().stop();
-      }
-
-   }
-
-   @Override
-   protected void createConfigs() throws Exception {
-      createReplicatedConfigs();
-   }
-
-   @Override
-   protected void crash(boolean failover, boolean waitFailure, ClientSession... sessions) throws Exception {
-      if (sessions.length > 0) {
-         for (ClientSession session : sessions) {
-            waitForRemoteBackup(session.getSessionFactory(), 5, true, backupServer.getServer());
-         }
-      } else {
-         waitForRemoteBackup(null, 5, true, backupServer.getServer());
-      }
-      super.crash(failover, waitFailure, sessions);
-   }
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/4bae8149/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NetworkReplicationTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NetworkReplicationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NetworkReplicationTest.java
new file mode 100644
index 0000000..98b169a
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NetworkReplicationTest.java
@@ -0,0 +1,198 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.artemis.tests.integration.cluster.failover;
+
+import java.net.InetAddress;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.activemq.artemis.api.core.TransportConfiguration;
+import org.apache.activemq.artemis.api.core.client.ClientSession;
+import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
+import org.apache.activemq.artemis.api.core.client.ServerLocator;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
+import org.apache.activemq.artemis.tests.util.TransportConfigurationUtils;
+import org.apache.activemq.artemis.tests.util.Wait;
+import org.jboss.logging.Logger;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class NetworkReplicationTest extends FailoverTestBase {
+
+   private static final Logger logger = Logger.getLogger(NetworkReplicationTest.class);
+
+   // This address is guaranteed to fail... reserved for documentation https://tools.ietf.org/html/rfc5737
+   private static final String badAddress = "203.0.113.1";
+
+   @Before
+   @Override
+   public void setUp() throws Exception {
+      this.startBackupServer = false;
+      super.setUp();
+   }
+
+   @Override
+   protected TransportConfiguration getAcceptorTransportConfiguration(final boolean live) {
+      return TransportConfigurationUtils.getNettyAcceptor(live, 1);
+   }
+
+   @Override
+   protected TransportConfiguration getConnectorTransportConfiguration(final boolean live) {
+      return TransportConfigurationUtils.getNettyConnector(live, 1);
+   }
+
+   protected ClientSession createSession(ClientSessionFactory sf1,
+                                         boolean xa,
+                                         boolean autoCommitSends,
+                                         boolean autoCommitAcks) throws Exception {
+      return addClientSession(sf1.createSession(xa, autoCommitSends, autoCommitAcks));
+   }
+
+   @Test
+   public void testReactivate() throws Exception {
+      liveServer.getServer().getConfiguration().setNetworkCheckPeriod(100).setNetworkCheckTimeout(200);
+      liveServer.start();
+
+      Assert.assertTrue(Wait.waitFor(liveServer::isActive));
+
+      liveServer.getServer().getNetworkHealthCheck().addAddress(InetAddress.getByName(badAddress));
+
+      Assert.assertTrue(Wait.waitFor(() -> !liveServer.isStarted()));
+
+      liveServer.getServer().getNetworkHealthCheck().clearAddresses();
+
+      Assert.assertTrue(Wait.waitFor(liveServer::isStarted));
+   }
+
+   @Test
+   public void testDoNotActivateOnIsolation() throws Exception {
+      AssertionLoggerHandler.startCapture();
+
+      try {
+         ServerLocator locator = getServerLocator();
+
+         // this block here is just to validate if ignoring loopback addresses logic is in place
+         {
+            backupServer.getServer().getNetworkHealthCheck().addAddress(InetAddress.getByName("127.0.0.1"));
+
+            Assert.assertTrue(AssertionLoggerHandler.findText("AMQ202001"));
+
+            AssertionLoggerHandler.clear();
+
+            backupServer.getServer().getNetworkHealthCheck().setIgnoreLoopback(true).addAddress(InetAddress.getByName("127.0.0.1"));
+
+            Assert.assertFalse(AssertionLoggerHandler.findText("AMQ202001"));
+
+            backupServer.getServer().getNetworkHealthCheck().clearAddresses();
+         }
+
+         backupServer.getServer().getNetworkHealthCheck().addAddress(InetAddress.getByName(badAddress));
+         backupServer.getServer().start();
+
+         ClientSessionFactory sf = addSessionFactory(locator.createSessionFactory());
+
+         ClientSession session = createSession(sf, false, true, true);
+
+         session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
+
+         Assert.assertFalse(backupServer.getServer().getNetworkHealthCheck().check());
+
+         crash(false, true, session);
+
+         for (int i = 0; i < 1000 && !backupServer.isStarted(); i++) {
+            Thread.sleep(10);
+         }
+
+         Assert.assertTrue(backupServer.isStarted());
+         Assert.assertFalse(backupServer.isActive());
+
+         liveServer.start();
+
+         for (int i = 0; i < 1000 && backupServer.getServer().getReplicationEndpoint() != null && !backupServer.getServer().getReplicationEndpoint().isStarted(); i++) {
+            Thread.sleep(10);
+         }
+
+         backupServer.getServer().getNetworkHealthCheck().clearAddresses();
+
+         // This will make sure the backup got synchronized after the network was activated again
+         Assert.assertTrue(backupServer.getServer().getReplicationEndpoint().isStarted());
+      } finally {
+         AssertionLoggerHandler.stopCapture();
+      }
+   }
+
+   @Test
+   public void testLiveIsolated() throws Exception {
+      backupServer.stop();
+
+      liveServer.stop();
+      liveServer.getServer().getConfiguration().setNetworkCheckList(badAddress).
+         setNetworkCheckPeriod(100).setNetworkCheckTimeout(100);
+
+      try {
+
+         liveServer.start();
+
+         Assert.assertEquals(100L, liveServer.getServer().getNetworkHealthCheck().getPeriod());
+
+         liveServer.getServer().getNetworkHealthCheck().setTimeUnit(TimeUnit.MILLISECONDS);
+
+         Assert.assertFalse(liveServer.getServer().getNetworkHealthCheck().check());
+
+         long timeout = System.currentTimeMillis() + 30000;
+         while (liveServer.isStarted() && System.currentTimeMillis() < timeout) {
+            Thread.sleep(100);
+         }
+
+         Assert.assertFalse(liveServer.isStarted());
+
+         liveServer.getServer().getNetworkHealthCheck().setIgnoreLoopback(true).addAddress(InetAddress.getByName("127.0.0.1"));
+
+         timeout = System.currentTimeMillis() + 30000;
+         while (!liveServer.isStarted() && System.currentTimeMillis() < timeout) {
+            Thread.sleep(100);
+         }
+
+         Assert.assertTrue(liveServer.isStarted());
+      } catch (Throwable e) {
+         logger.warn(e.getMessage(), e);
+         throw e;
+      } finally {
+         liveServer.getServer().stop();
+         backupServer.getServer().stop();
+      }
+
+   }
+
+   @Override
+   protected void createConfigs() throws Exception {
+      createReplicatedConfigs();
+   }
+
+   @Override
+   protected void crash(boolean failover, boolean waitFailure, ClientSession... sessions) throws Exception {
+      if (sessions.length > 0) {
+         for (ClientSession session : sessions) {
+            waitForRemoteBackup(session.getSessionFactory(), 5, true, backupServer.getServer());
+         }
+      } else {
+         waitForRemoteBackup(null, 5, true, backupServer.getServer());
+      }
+      super.crash(failover, waitFailure, sessions);
+   }
+}


[2/4] activemq-artemis git commit: ARTEMIS-1253 Refactoring renaming stop(boolean) to fail(boolean)

Posted by cl...@apache.org.
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)


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/36110da9
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/36110da9
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/36110da9

Branch: refs/heads/master
Commit: 36110da9c834d606c0c5fb731b4e79504d32d7b2
Parents: 4bae814
Author: Clebert Suconic <cl...@apache.org>
Authored: Mon Jun 26 12:52:18 2017 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon Jun 26 16:15:39 2017 -0400

----------------------------------------------------------------------
 .../core/management/impl/ActiveMQServerControlImpl.java |  4 ++--
 .../activemq/artemis/core/server/ActiveMQServer.java    |  2 +-
 .../artemis/core/server/impl/ActiveMQServerImpl.java    |  2 +-
 .../core/server/impl/SharedNothingLiveActivation.java   |  2 +-
 .../activemq/artemis/tests/util/ActiveMQTestBase.java   |  2 +-
 .../artemis/tests/extras/byteman/BMFailoverTest.java    |  2 +-
 .../extras/byteman/LargeMessageOverReplicationTest.java |  2 +-
 .../RaceOnSyncLargeMessageOverReplication2Test.java     |  2 +-
 .../RaceOnSyncLargeMessageOverReplicationTest.java      |  2 +-
 .../tests/extras/byteman/StartStopDeadlockTest.java     |  2 +-
 .../integration/client/InterruptedLargeMessageTest.java | 12 ++++++------
 .../integration/cluster/bridge/BridgeReconnectTest.java |  6 +++---
 .../tests/integration/cluster/bridge/BridgeTest.java    |  2 +-
 .../cluster/failover/GroupingFailoverTestBase.java      |  4 ++--
 .../cluster/util/SameProcessActiveMQServer.java         |  2 +-
 .../integration/divert/ReplicationWithDivertTest.java   |  2 +-
 .../integration/jms/server/management/JMSUtil.java      |  2 +-
 .../tests/integration/mqtt/imported/MQTTTest.java       |  2 +-
 .../paging/PagingWithFailoverAndCountersTest.java       |  2 +-
 .../tests/integration/server/SimpleStartStopTest.java   |  2 +-
 20 files changed, 29 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/36110da9/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
index faa25cc..069ebf0 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
@@ -2216,7 +2216,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
 
       clearIO();
 
-      server.stop(true);
+      server.fail(true);
    }
 
    @Override
@@ -2251,7 +2251,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
             liveOnlyPolicy.getScaleDownPolicy().getConnectors().add(0, connector);
          }
 
-         server.stop(true);
+         server.fail(true);
       }
 
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/36110da9/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
index 42ba7a2..5d4aaeb 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
@@ -381,7 +381,7 @@ public interface ActiveMQServer extends ServiceComponent {
     */
    boolean isAddressBound(String address) throws Exception;
 
-   void stop(boolean failoverOnServerShutdown) throws Exception;
+   void fail(boolean failoverOnServerShutdown) throws Exception;
 
    Queue updateQueue(String name,
                      RoutingType routingType,

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/36110da9/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
----------------------------------------------------------------------
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 c0e0c9e..6ab95ee 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
@@ -832,7 +832,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
    }
 
    @Override
-   public final void stop(boolean failoverOnServerShutdown) throws Exception {
+   public final void fail(boolean failoverOnServerShutdown) throws Exception {
       stop(failoverOnServerShutdown, false, false, false);
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/36110da9/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java
index 7e8eb5d..ce67e21 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java
@@ -180,7 +180,7 @@ public class SharedNothingLiveActivation extends LiveActivation {
                      clusterConnection.addClusterTopologyListener(listener1);
                      if (listener1.waitForBackup()) {
                         //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();
                         //                        activeMQServer.moveServerData(replicatedPolicy.getReplicaPolicy().getMaxSavedReplicatedJournalsSize());
                         activeMQServer.setHAPolicy(replicatedPolicy.getReplicaPolicy());

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/36110da9/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java
index 17f2d88..1b35393 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java
@@ -2358,7 +2358,7 @@ public abstract class ActiveMQTestBase extends Assert {
       clusterManager.flushExecutor();
       clusterManager.clear();
       Assert.assertTrue("server should be running!", server.isStarted());
-      server.stop(true);
+      server.fail(true);
 
       if (sessions.length > 0) {
          // Wait to be informed of failure

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/36110da9/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BMFailoverTest.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BMFailoverTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BMFailoverTest.java
index e658a53..9ccd1f8 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BMFailoverTest.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BMFailoverTest.java
@@ -71,7 +71,7 @@ public class BMFailoverTest extends FailoverTestBase {
    public static void stopAndThrow() throws ActiveMQUnBlockedException {
       if (!stopped) {
          try {
-            serverToStop.getServer().stop(true);
+            serverToStop.getServer().fail(true);
          } catch (Exception e) {
             e.printStackTrace();
          }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/36110da9/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/LargeMessageOverReplicationTest.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/LargeMessageOverReplicationTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/LargeMessageOverReplicationTest.java
index d228c22..ddedeaa 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/LargeMessageOverReplicationTest.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/LargeMessageOverReplicationTest.java
@@ -233,7 +233,7 @@ public class LargeMessageOverReplicationTest extends ActiveMQTestBase {
 
       try {
          if (messageChunkCount == 10) {
-            liveServer.stop(true);
+            liveServer.fail(true);
 
             System.err.println("activating");
             if (!backupServer.waitForActivation(1, TimeUnit.MINUTES)) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/36110da9/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/RaceOnSyncLargeMessageOverReplication2Test.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/RaceOnSyncLargeMessageOverReplication2Test.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/RaceOnSyncLargeMessageOverReplication2Test.java
index 0437ae0..3888a3e 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/RaceOnSyncLargeMessageOverReplication2Test.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/RaceOnSyncLargeMessageOverReplication2Test.java
@@ -221,7 +221,7 @@ public class RaceOnSyncLargeMessageOverReplication2Test extends ActiveMQTestBase
 
       waitForRemoteBackup(connection.getSessionFactory(), 30);
 
-      liveServer.stop(true);
+      liveServer.fail(true);
 
       Assert.assertTrue(failedOver.await(10, TimeUnit.SECONDS));
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/36110da9/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/RaceOnSyncLargeMessageOverReplicationTest.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/RaceOnSyncLargeMessageOverReplicationTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/RaceOnSyncLargeMessageOverReplicationTest.java
index 99818d4..162c4d1 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/RaceOnSyncLargeMessageOverReplicationTest.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/RaceOnSyncLargeMessageOverReplicationTest.java
@@ -200,7 +200,7 @@ public class RaceOnSyncLargeMessageOverReplicationTest extends ActiveMQTestBase
 
       Assert.assertFalse(t.isAlive());
 
-      liveServer.stop(true);
+      liveServer.fail(true);
 
       Assert.assertTrue(failedOver.await(10, TimeUnit.SECONDS));
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/36110da9/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/StartStopDeadlockTest.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/StartStopDeadlockTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/StartStopDeadlockTest.java
index 29c885a..03f3e19 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/StartStopDeadlockTest.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/StartStopDeadlockTest.java
@@ -92,7 +92,7 @@ public class StartStopDeadlockTest extends ActiveMQTestBase {
                align.countDown();
                startLatch.await();
                System.out.println("Crashing....");
-               serverLive.stop(true);
+               serverLive.fail(true);
             } catch (Exception e) {
                errors.incrementAndGet();
                e.printStackTrace();

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/36110da9/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InterruptedLargeMessageTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InterruptedLargeMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InterruptedLargeMessageTest.java
index 44015e1..f926af1 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InterruptedLargeMessageTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InterruptedLargeMessageTest.java
@@ -129,7 +129,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase {
 //         ((ServerSessionImpl) srvSession).clearLargeMessage();
 //      }
 
-      server.stop(false);
+      server.fail(false);
 
       ActiveMQTestBase.forceGC();
 
@@ -307,7 +307,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase {
          session.rollback();
       }
 
-      server.stop(false);
+      server.fail(false);
       server.start();
 
       server.stop();
@@ -385,7 +385,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase {
          sf.close();
       }
 
-      server.stop(false);
+      server.fail(false);
       server.start();
 
       validateNoFilesOnLargeDir();
@@ -443,7 +443,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase {
       session.close();
       sf.close();
 
-      server.stop(false);
+      server.fail(false);
       server.start();
 
       for (int start = 0; start < 2; start++) {
@@ -635,7 +635,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase {
       }
 
       ((ActiveMQServerImpl) server).replaceQueueFactory(original);
-      server.stop(false);
+      server.fail(false);
       server.start();
 
       server.stop();
@@ -698,7 +698,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase {
       }
 
       ((ActiveMQServerImpl) server).replaceQueueFactory(original);
-      server.stop(false);
+      server.fail(false);
       server.start();
 
       server.stop();

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/36110da9/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeReconnectTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeReconnectTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeReconnectTest.java
index 4a6fcaa..88c0e81 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeReconnectTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeReconnectTest.java
@@ -155,7 +155,7 @@ public class BridgeReconnectTest extends BridgeTestBase {
       startServers();
 
       waitForServerStart(server0);
-      server0.stop(true);
+      server0.fail(true);
 
       waitForServerStart(server2);
 
@@ -206,7 +206,7 @@ public class BridgeReconnectTest extends BridgeTestBase {
 
       BridgeReconnectTest.log.info("** failing connection");
       // Now we will simulate a failure of the bridge connection between server0 and server1
-      server0.stop(true);
+      server0.fail(true);
 
       waitForServerStart(server2);
 
@@ -285,7 +285,7 @@ public class BridgeReconnectTest extends BridgeTestBase {
 
       startServers();
       // 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);
       ClientSessionFactory csf0 = addSessionFactory(locator.createSessionFactory(server2tc));

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/36110da9/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java
index 2084796..e6a028f 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java
@@ -1455,7 +1455,7 @@ public class BridgeTest extends ActiveMQTestBase {
                      try {
                         System.out.println("Stopping server");
                         latch.countDown();
-                        serverToStop.stop(false);
+                        serverToStop.fail(false);
                      } catch (Exception e) {
                         e.printStackTrace();
                      }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/36110da9/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/GroupingFailoverTestBase.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/GroupingFailoverTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/GroupingFailoverTestBase.java
index 41f0e8f..de8c02c 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/GroupingFailoverTestBase.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/GroupingFailoverTestBase.java
@@ -93,7 +93,7 @@ public abstract class GroupingFailoverTestBase extends ClusterTestBase {
 
       closeSessionFactory(0);
 
-      servers[0].stop(true);
+      servers[0].fail(true);
 
       waitForServerRestart(2);
 
@@ -194,7 +194,7 @@ public abstract class GroupingFailoverTestBase extends ClusterTestBase {
 
       closeSessionFactory(0);
 
-      servers[0].stop(true);
+      servers[0].fail(true);
 
       waitForServerRestart(2);
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/36110da9/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/util/SameProcessActiveMQServer.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/util/SameProcessActiveMQServer.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/util/SameProcessActiveMQServer.java
index 35e17aa..06305b4 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/util/SameProcessActiveMQServer.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/util/SameProcessActiveMQServer.java
@@ -92,7 +92,7 @@ public class SameProcessActiveMQServer implements TestableServer {
       clusterManager.flushExecutor();
       clusterManager.clear();
       Assert.assertTrue("server should be running!", server.isStarted());
-      server.stop(failover);
+      server.fail(failover);
 
       if (waitFailure) {
          // Wait to be informed of failure

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/36110da9/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/ReplicationWithDivertTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/ReplicationWithDivertTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/ReplicationWithDivertTest.java
index ede56f1..dc179f9 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/ReplicationWithDivertTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/ReplicationWithDivertTest.java
@@ -220,7 +220,7 @@ public class ReplicationWithDivertTest extends ActiveMQTestBase {
       }
 
       Assert.assertFalse(t.isAlive());
-      liveServer.stop(true);
+      liveServer.fail(true);
       Assert.assertTrue(failedOver.await(10, TimeUnit.SECONDS));
 
       {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/36110da9/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/JMSUtil.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/JMSUtil.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/JMSUtil.java
index e8af049..fc0b370 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/JMSUtil.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/JMSUtil.java
@@ -257,7 +257,7 @@ public class JMSUtil {
 
       ClusterManager clusterManager = server.getClusterManager();
       clusterManager.clear();
-      server.stop(true);
+      server.fail(true);
 
       // Wait to be informed of failure
       boolean ok = latch.await(10000, TimeUnit.MILLISECONDS);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/36110da9/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java
index d8db226..2e67dd6 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java
@@ -1886,7 +1886,7 @@ public class MQTTTest extends MQTTTestSupport {
       connection1.connect();
       connection1.publish(address, payload.getBytes(), QoS.AT_LEAST_ONCE, true);
 
-      getServer().stop(false);
+      getServer().fail(false);
       getServer().start();
       waitForServerToStart(getServer());
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/36110da9/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingWithFailoverAndCountersTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingWithFailoverAndCountersTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingWithFailoverAndCountersTest.java
index 06bf59a..0bc286e 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingWithFailoverAndCountersTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingWithFailoverAndCountersTest.java
@@ -73,7 +73,7 @@ public class PagingWithFailoverAndCountersTest extends ActiveMQTestBase {
 
       if (inProcessBackup != null) {
          try {
-            inProcessBackup.getServer().stop(false);
+            inProcessBackup.getServer().fail(false);
          } catch (Throwable ignored) {
             ignored.printStackTrace();
          }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/36110da9/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/SimpleStartStopTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/SimpleStartStopTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/SimpleStartStopTest.java
index c372a2d..27d6f8a 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/SimpleStartStopTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/SimpleStartStopTest.java
@@ -47,7 +47,7 @@ public class SimpleStartStopTest extends ActiveMQTestBase {
          for (int i = 0; i < 50; i++) {
             server = createServer(true, false);
             server.start();
-            server.stop(false);
+            server.fail(false);
          }
 
          // There shouldn't be any error from starting / stopping the server