You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Fredrik Bakkevig Haugli <fr...@gmail.com> on 2014/11/05 10:18:22 UTC

JMS: Dispatcher threads don't disappear after MessageConsumer is closed

Hello,



I am working on a project that uses qpid for communication in an OSGi based
system. One bundle creates a connection that other bundles can use through
its OSGi-interface. One problem I have is that whenever a MessageConsumer
is created in the connection bundle, a dispatcher thread is created for it
and this thread lingers on even after the consumer is closed. These threads
show up as 'Dispatcher-<some-number>-Conn-1' in the Netbeans debugging
inteface.


If another bundle for some reason is restarted, it will create new
MessageConsumers which creates new threads without killing the old ones,
even if it tries to clean up after itself by closing its consumers first.
The only way of removing these threads that I have found is to restart the
connection bundle (which closes and creates a new connection), something
that might require restarting all other bundles that use it, which is not
ideal.


These threads does not really cause a direct problem as the application
works fine even though they are running, but having an unbounded number of
threads does not seem like a good thing in the long run.



My question is:

Are these dispatcher threads supposed to carry on after the consumer is
closed, or is there a way to kill them without closing the connection?



Fredrik Bakkevig Haugli

Re: JMS: Dispatcher threads don't disappear after MessageConsumer is closed

Posted by Robbie Gemmell <ro...@gmail.com>.
The dispatcher threads exist on a per-session basis rather than
per-consumer. Closing the session should make them go away, but closing a
consumer does not.

The <some-number> in 'Dispatcher-<some-number>-Conn-1' name is the
particular AMQP channel number the session is using on its parent
connection.

Robbie

On 5 November 2014 09:18, Fredrik Bakkevig Haugli <fr...@gmail.com>
wrote:

> Hello,
>
>
>
> I am working on a project that uses qpid for communication in an OSGi based
> system. One bundle creates a connection that other bundles can use through
> its OSGi-interface. One problem I have is that whenever a MessageConsumer
> is created in the connection bundle, a dispatcher thread is created for it
> and this thread lingers on even after the consumer is closed. These threads
> show up as 'Dispatcher-<some-number>-Conn-1' in the Netbeans debugging
> inteface.
>
>
> If another bundle for some reason is restarted, it will create new
> MessageConsumers which creates new threads without killing the old ones,
> even if it tries to clean up after itself by closing its consumers first.
> The only way of removing these threads that I have found is to restart the
> connection bundle (which closes and creates a new connection), something
> that might require restarting all other bundles that use it, which is not
> ideal.
>
>
> These threads does not really cause a direct problem as the application
> works fine even though they are running, but having an unbounded number of
> threads does not seem like a good thing in the long run.
>
>
>
> My question is:
>
> Are these dispatcher threads supposed to carry on after the consumer is
> closed, or is there a way to kill them without closing the connection?
>
>
>
> Fredrik Bakkevig Haugli
>