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 2016/08/23 17:26:58 UTC
[1/2] activemq-artemis git commit: ARTEMIS-686 shutdown external
components
Repository: activemq-artemis
Updated Branches:
refs/heads/master d03f6c867 -> 64a1fcdb2
ARTEMIS-686 shutdown external components
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/3fd9fbe2
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/3fd9fbe2
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/3fd9fbe2
Branch: refs/heads/master
Commit: 3fd9fbe2d0b8e9e1b29c31e6472da192e12329f6
Parents: d03f6c8
Author: jbertram <jb...@apache.com>
Authored: Fri Aug 19 13:58:32 2016 -0500
Committer: jbertram <jb...@apache.com>
Committed: Fri Aug 19 14:00:17 2016 -0500
----------------------------------------------------------------------
.../apache/activemq/artemis/cli/commands/Run.java | 17 +++--------------
.../activemq/artemis/integration/Broker.java | 3 ++-
.../activemq/artemis/integration/FileBroker.java | 6 ++++++
.../artemis/core/server/ActiveMQServer.java | 2 ++
.../core/server/impl/ActiveMQServerImpl.java | 16 ++++++++++++++++
5 files changed, 29 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3fd9fbe2/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 3a0c6c9..359a564 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
@@ -17,7 +17,6 @@
package org.apache.activemq.artemis.cli.commands;
import java.io.File;
-import java.util.ArrayList;
import java.util.Timer;
import java.util.TimerTask;
@@ -27,7 +26,6 @@ import org.apache.activemq.artemis.cli.Artemis;
import org.apache.activemq.artemis.cli.commands.tools.LockAbstract;
import org.apache.activemq.artemis.components.ExternalComponent;
import org.apache.activemq.artemis.core.config.impl.FileConfiguration;
-import org.apache.activemq.artemis.core.server.ActiveMQComponent;
import org.apache.activemq.artemis.dto.BrokerDTO;
import org.apache.activemq.artemis.dto.ComponentDTO;
import org.apache.activemq.artemis.factory.BrokerFactory;
@@ -59,8 +57,6 @@ public class Run extends LockAbstract {
private Broker server;
- private ArrayList<ActiveMQComponent> components = new ArrayList<>();
-
@Override
public Object execute(ActionContext context) throws Exception {
super.execute(context);
@@ -90,7 +86,7 @@ public class Run extends LockAbstract {
ExternalComponent component = (ExternalComponent) clazz.newInstance();
component.configure(componentDTO, getBrokerInstance(), getBrokerHome());
component.start();
- components.add(component);
+ server.getServer().addExternalComponent(component);
}
return null;
}
@@ -102,13 +98,6 @@ public class Run extends LockAbstract {
fileConfiguration.getLargeMessagesLocation().mkdirs();
}
- private void stopServerAndComponenets() throws Exception {
- for (ActiveMQComponent component : components) {
- component.stop();
- }
- server.stop();
- }
-
/**
* Add a simple shutdown hook to stop the server.
*
@@ -146,7 +135,7 @@ public class Run extends LockAbstract {
if (file.exists()) {
try {
try {
- stopServerAndComponenets();
+ server.stop();
}
catch (Exception e) {
e.printStackTrace();
@@ -169,7 +158,7 @@ public class Run extends LockAbstract {
@Override
public void run() {
try {
- stopServerAndComponenets();
+ server.stop();
}
catch (Exception e) {
e.printStackTrace();
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3fd9fbe2/artemis-cli/src/main/java/org/apache/activemq/artemis/integration/Broker.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/integration/Broker.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/integration/Broker.java
index 306675f..494101e 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/integration/Broker.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/integration/Broker.java
@@ -17,10 +17,11 @@
package org.apache.activemq.artemis.integration;
import org.apache.activemq.artemis.core.server.ActiveMQComponent;
+import org.apache.activemq.artemis.core.server.ActiveMQServer;
/**
* A Broker os a set of ActiveMQComponents that create a Server, for instance core and jms.
*/
public interface Broker extends ActiveMQComponent {
-
+ ActiveMQServer getServer();
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3fd9fbe2/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 8ae5729..b120cc7 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
@@ -19,6 +19,7 @@ package org.apache.activemq.artemis.integration;
import org.apache.activemq.artemis.core.config.FileDeploymentManager;
import org.apache.activemq.artemis.core.config.impl.FileConfiguration;
import org.apache.activemq.artemis.core.server.ActiveMQComponent;
+import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.dto.ServerDTO;
import org.apache.activemq.artemis.integration.bootstrap.ActiveMQBootstrapLogger;
import org.apache.activemq.artemis.jms.server.config.impl.FileJMSConfiguration;
@@ -103,4 +104,9 @@ public class FileBroker implements Broker {
activeMQComponents.add(components.get("core"));
return activeMQComponents;
}
+
+ @Override
+ public ActiveMQServer getServer() {
+ return (ActiveMQServer) components.get("core");
+ }
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3fd9fbe2/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 b777ced..0842c0d 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
@@ -395,4 +395,6 @@ public interface ActiveMQServer extends ActiveMQComponent {
void setHAPolicy(HAPolicy haPolicy);
void setMBeanServer(MBeanServer mBeanServer);
+
+ void addExternalComponent(ActiveMQComponent externalComponent);
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3fd9fbe2/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 0d25271..25511b0 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
@@ -303,6 +303,8 @@ public class ActiveMQServerImpl implements ActiveMQServer {
private ServiceRegistry serviceRegistry;
private Date startDate;
+
+ private final List<ActiveMQComponent> externalComponents = new ArrayList<>();
// Constructors
// ---------------------------------------------------------------------------------
@@ -555,6 +557,11 @@ public class ActiveMQServerImpl implements ActiveMQServer {
this.mbeanServer = mbeanServer;
}
+ @Override
+ public void addExternalComponent(ActiveMQComponent externalComponent) {
+ externalComponents.add(externalComponent);
+ }
+
public ExecutorService getThreadPool() {
return threadPool;
}
@@ -936,6 +943,15 @@ public class ActiveMQServerImpl implements ActiveMQServer {
scaledDownNodeIDs.clear();
+ for (ActiveMQComponent externalComponent : externalComponents) {
+ try {
+ externalComponent.stop();
+ }
+ catch (Exception e) {
+ ActiveMQServerLogger.LOGGER.errorStoppingComponent(e, externalComponent.getClass().getName());
+ }
+ }
+
if (identity != null) {
ActiveMQServerLogger.LOGGER.serverStopped("identity=" + identity + ",version=" + getVersion().getFullVersion(), tempNodeID, getUptime());
}
[2/2] activemq-artemis git commit: This closes #727
Posted by cl...@apache.org.
This closes #727
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/64a1fcdb
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/64a1fcdb
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/64a1fcdb
Branch: refs/heads/master
Commit: 64a1fcdb2d73eb202921d5911041a8947787e553
Parents: d03f6c8 3fd9fbe
Author: Clebert Suconic <cl...@apache.org>
Authored: Tue Aug 23 13:26:49 2016 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Tue Aug 23 13:26:49 2016 -0400
----------------------------------------------------------------------
.../apache/activemq/artemis/cli/commands/Run.java | 17 +++--------------
.../activemq/artemis/integration/Broker.java | 3 ++-
.../activemq/artemis/integration/FileBroker.java | 6 ++++++
.../artemis/core/server/ActiveMQServer.java | 2 ++
.../core/server/impl/ActiveMQServerImpl.java | 16 ++++++++++++++++
5 files changed, 29 insertions(+), 15 deletions(-)
----------------------------------------------------------------------