You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Dennis Cheung <hk...@gmail.com> on 2007/03/21 16:12:31 UTC

How can I completely shutdown ActiveMQ client correctly?

I have some problem on shutting down the ActiveMQ client (not the broker).

----
I have a Java application using ActiveMQ 4.0.2.  (async send is already
disabled, tcpNoDelay is enabled)

   1. Create temporary topic A.
   2. Send message to another queue B.
   3. Receive a message on topic A, with a timeout given.
   4. Send 2nd message to queue B.
   5. Close the application

On step 5, I do close all safe shutdown step,
  close producer, close consumer, delete TemporaryQueue, close JMS session
and close JMS connection.
But I found that some ActiveMQ thread still running on the background.
And my client application does not shutdown after "static void main"
finished.
((It is a multi-thread application. I am not sure is it my thread or
activemq thread is not daemon, and JVM was blocked and not shutting down.))

And now, I have to call System.exit(0) to force the JVM being closed.
-----

I just want to make sure that is it a safe operation?? The ActiveMQ broker
will not fail?

Beside, I found that there are so many Advisory Message consumer of
temporary topic/queue on the BROKER, ever if all client are already closed.
Is it related to the above statements?

Thanks,

----
Dennis

Re: How can I completely shutdown ActiveMQ client correctly?

Posted by Hiram Chirino <hi...@hiramchirino.com>.
Doing a connection.close() should be sufficient.

On 3/21/07, Dennis Cheung <hk...@gmail.com> wrote:
> I have some problem on shutting down the ActiveMQ client (not the broker).
>
> ----
> I have a Java application using ActiveMQ 4.0.2.  (async send is already
> disabled, tcpNoDelay is enabled)
>
>    1. Create temporary topic A.
>    2. Send message to another queue B.
>    3. Receive a message on topic A, with a timeout given.
>    4. Send 2nd message to queue B.
>    5. Close the application
>
> On step 5, I do close all safe shutdown step,
>   close producer, close consumer, delete TemporaryQueue, close JMS session
> and close JMS connection.
> But I found that some ActiveMQ thread still running on the background.
> And my client application does not shutdown after "static void main"
> finished.
> ((It is a multi-thread application. I am not sure is it my thread or
> activemq thread is not daemon, and JVM was blocked and not shutting down.))
>
> And now, I have to call System.exit(0) to force the JVM being closed.
> -----
>
> I just want to make sure that is it a safe operation?? The ActiveMQ broker
> will not fail?
>
> Beside, I found that there are so many Advisory Message consumer of
> temporary topic/queue on the BROKER, ever if all client are already closed.
> Is it related to the above statements?
>
> Thanks,
>
> ----
> Dennis
>


-- 
Regards,
Hiram

Blog: http://hiramchirino.com