activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anna Maier <>
Subject Problem shutting down activemq client with failover transport
Date Tue, 29 Sep 2015 13:31:13 GMT

I am using Camel to connect to ActiveMQ and it fails to shutdown when the ActiveMQComponent
cannot make a connection to the broker with the failover protocol (activemq version 5.12.0).

The problem seems to be that the failover transport tries to connect to the broker in an endless
loop on its own thread that cannot be interrupted. I think the problem is in the PooledTaskRunner:
there is a shutdown field which is set to true when camel shuts down, but it appears as false
to the thread that is running the endless loop.

I am currently at a loss what to do. I want to keep the maximum retries setting for the failover
transport on indefinite, since I do not know when the the broker is back online. At the same
time, it has to be possible to shut down the application even if there never was a connection
to the ActiveMQ broker.

Has anybody seen this problem before and can give some advice? Is this a bug in ActiveMQ?

Attached there is some code that reproduces the problem - it never terminates.



The code:
public class ShutdownBug {

     public static void main(String[] args) throws Exception {
         DefaultCamelContext camelContext = new DefaultCamelContext();
         ActiveMQComponent activeMQComponent = new ActiveMQComponent();
         camelContext.addComponent("activemq", activeMQComponent);
         camelContext.addRoutes(new RouteBuilder() {
              public void configure() {
         Thread startThread = new Thread(new Runnable() {
              public void run() {
                   try {
                   catch (Exception e) {


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message