activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/4] activemq-artemis git commit: ARTEMIS-1253 Fixing NetworkHealthCheck being shutdown after failures
Date Tue, 27 Jun 2017 16:19:52 GMT
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 <clebertsuconic@apache.org>
Authored: Mon Jun 26 13:13:43 2017 -0400
Committer: Clebert Suconic <clebertsuconic@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();


Mime
View raw message