activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Tully <gary.tu...@gmail.com>
Subject Re: [Old issue] Memory leak after stop web application in Tomcat
Date Wed, 18 Jul 2012 13:25:19 GMT
Two suggestions:

introduce a DisposableBean to call the static shutdown methods on amq
so that they don't occur too early. Calling them from the main app
stop is too early as they will stop a close from being successful.

something like:
public class Shutdown implements DisposableBean {
    private static final Logger log = LoggerFactory.getLogger(Shutdown.class);

    @Override
    public void destroy() throws Exception {
        log.info("Doing amq static shutdown");
        try {
            DefaultThreadPools.getDefaultTaskRunnerFactory().shutdown();
        } finally {
            DefaultThreadPools.shutdown();
        }
    }
}

and add to your context like: <bean id="shutdown" class="com.foo.Shutdown" />

Also ensure that every call to getConnection has a corresponding call
to close, even if the call to connection pool stop has this covered,
it may be that some interaction causes a close from pool.stop to clash
and fail. But in that case I would expect to see something to that
effect in the log.

On 18 July 2012 06:32, liny <innocentliny@gmail.com> wrote:
> Hi gtully:
>
> I changed to use 5.7-SNAPSHOT and did below in com.foo.MainApplication#stop:
>
>
> But still not work for me.
> Did ActiveMQ call AbstractInactivityMonitor#stopMonitorThreads while
> Connection#close?
> Or anything missing?
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Old-issue-Memory-leak-after-stop-web-application-in-Tomcat-tp4653959p4654109.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
http://fusesource.com
http://blog.garytully.com

Mime
View raw message