activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtruchado <>
Subject Re: activemq-client does not close properly connections to the broker
Date Tue, 13 May 2014 10:34:08 GMT
IMHO I have here one candidate

class ActiveMQConnection:

The method stop() is called on my stacktrace on the method close(), so first
try to close the ActiveMQ connection, then the transport (which is good).

The method stop() looks like this:

    public void stop() throws JMSException {
        *if (started.compareAndSet(true, false)) {*
            synchronized(sessions) {
                for (Iterator<ActiveMQSession> i = sessions.iterator();
i.hasNext();) {
                    ActiveMQSession s =;

when I was debugging the code the condition was always false, the reason is
that the variable (AtomicBoolean) started is never set to true. You can
check this by looking yourself at this class.

It is set only to false when the close() method is invoked, but on the
method start() or on a similar place the invocation to /started.set(true); /
is missing.

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message