activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul French <>
Subject running a jms client with mulitple threads
Date Fri, 28 Jul 2006 17:31:51 GMT

I have a work around but I'm wondering if anyone else has a better idea?

I use a PooledConnectionfactory for my JMS connections.

I start say 10 threads from my main thread all part of the same thread
group. They send some JMS messages and then finish.

I need to detect when all the threads have finshed so I can close the
PooledConnectionFactory by calling stop() to release the system resources.

The problem I have is the first JMS call within one of the new threads
starts up the acivemq processes on the client (3 of them, a connection and 2
schedulers) and they automatically become part of my ThreadGroup. These
threads never die!! Hence even when all my threads stop I still have active
activemq threads part of the threadgroup.

I did a work around by calling start on the PooledConnectionFactory from
within the main thread before I started my 10 threads. Then it is easy to
check the threadgroup active count is zero before I call stop().

Any better ideas since I'm not sure if I will always have the luxury of
pre-starting the connection pool.
View this message in context:
Sent from the ActiveMQ - User forum at

View raw message