https://issues.apache.org/jira/browse/AMQ-4034 - osgi restart broker properly when pid properties changes

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1441435 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2013-02-01 12:58:26 +00:00
parent 88beb15763
commit acd1eda402
2 changed files with 5 additions and 2 deletions

View File

@ -46,6 +46,10 @@ public class ActiveMQServiceFactory implements ManagedServiceFactory {
@Override @Override
synchronized public void updated(String pid, Dictionary properties) throws ConfigurationException { synchronized public void updated(String pid, Dictionary properties) throws ConfigurationException {
// First stop currently running broker (if any)
deleted(pid);
String config = (String)properties.get("config"); String config = (String)properties.get("config");
if (config == null) { if (config == null) {
throw new ConfigurationException("config", "Property must be set"); throw new ConfigurationException("config", "Property must be set");
@ -106,13 +110,12 @@ public class ActiveMQServiceFactory implements ManagedServiceFactory {
@Override @Override
synchronized public void deleted(String pid) { synchronized public void deleted(String pid) {
LOG.info("Stopping broker " + pid);
BrokerService broker = brokers.get(pid); BrokerService broker = brokers.get(pid);
if (broker == null) { if (broker == null) {
LOG.warn("Broker " + pid + " not found");
return; return;
} }
try { try {
LOG.info("Stopping broker " + pid);
broker.stop(); broker.stop();
broker.waitUntilStopped(); broker.waitUntilStopped();
} catch (Exception e) { } catch (Exception e) {