activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: [HEADS UP] - Graceful shutdown of AMQ and fixing some leaks when doing hot-deployment
Date Thu, 06 Sep 2012 15:20:31 GMT

Okay I have been running a bunch of unit tests, and I can see that the
tests from activemq-core, is kinda dependent on the old behavior
of shutting down thread pools aggressively using shutdownNow or no
attempt to wait for in progress tasks to complete gracefully.

So the changes being committed is currently to keep same behavior of
shutting down. Then we can gently switch over to
graceful shutdown as we fix the tests and identify the ones to switch over.

So ThreadPoolUtils have 3 set of shutdown methods
- shutdown
- shutdownNow
- shutdownGraceful

The first 2 is just like on the JDK executor service.
The last one is the graceful one.

On Thu, Sep 6, 2012 at 2:47 PM, Claus Ibsen <> wrote:
> Hi
> Recently I have been diving into fixing some leaks in ActiveMQ. It
> started with the activemq-pool component which caused a Camel JMS
> client to become slower, due memory leaks not being released.
> The activemq-pool has been fixed now, and runs flawless again.
> On a side note Tim Bish is working on improving the activemq-pool to
> be a better pool by leveraging more logic from commons-pool on the
> connection side as well. Beforehand it was only the sessions that was
> leveraged.
> Anyway continuing with the Camel JMS client, we have reports, about
> leaks in Tomcat, when you redeploy an application. So I have been
> tracking those down, and got most of it fixed. Have some pending
> commits for the JMS client.
> However on embedded a full blow ActiveMQ broker in a web container as
> Tomcat, and then supporting hot deployment, surfaced some issues with
> some thread pools not being closed graceful. Instead the pools is
> closed aggresively, and as some of them have idle threads timeout of
> 30 seconds, then those threads dont timeout before the application is
> redeployed (assuming you re-deploy the app; to remedy this you would
> have to stop the app, and wait for > 30 sec, and then deploy again).
> As we have some good graceful shutdown code in Camel, I have ported
> part of that to AMQ, in the ThreadPoolUtils class in the util package.
> There is a number of shutdown methods, to use for graceful shutdown.
> When a graceful shutdown of a thread pool is in the works, and if it
> takes some times, then we now log every 5th second about the shutdown
> in progress.
> There is a number of tickets in JIRA about this recent work (all the
> stuff above, etc.)
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email:
> Web:
> Twitter: davsclaus, fusenews
> Blog:
> Author of Camel in Action:

Claus Ibsen
Twitter: davsclaus, fusenews
Author of Camel in Action:

View raw message