Hi All,
I am using ActiveMQ version 5.11.1. Following is a simple code snippet
which reproduces the problem I am getting. (what I am trying to
implement is a restart, but the exceptions are thrown when stopping).
import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.network.jms.JmsQueueConnector;
import org.apache.activemq.network.jms.OutboundQueueBridge;
public class StopTest {
public static void main(String[] args) throws Exception {
BrokerService broker = new BrokerService();
broker.addConnector("tcp://localhost:61617");
JmsQueueConnector connector = new JmsQueueConnector();
connector.setOutboundQueueConnectionFactory(new
ActiveMQConnectionFactory(ActiveMQConnection.DEFAULT_BROKER_URL));
OutboundQueueBridge outboundQueueBridge = new
OutboundQueueBridge("queue");
connector.setOutboundQueueBridges(new OutboundQueueBridge[] {
outboundQueueBridge });
broker.setJmsBridgeConnectors(new JmsQueueConnector[] { connector });
broker.start();
broker.waitUntilStarted();
broker.stop();
broker.waitUntilStopped();
}
}
I get the following exception
Exception in thread "ActiveMQ VMTransport: vm://localhost#1-1"
org.apache.activemq.broker.BrokerStoppedException: Broker
BrokerService[localhost] is being stopped
at
org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:193)
at
org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:116)
at
org.apache.activemq.transport.MutexTransport.onCommand(MutexTransport.java:50)
at
org.apache.activemq.transport.vm.VMTransport.iterate(VMTransport.java:248)
at
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:133)
at
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:48)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Can someone point out to me what I am not doing correctly?
--
Thanks,
Pubudu