6 Replies Latest reply on Mar 9, 2011 6:16 PM by hughbragg

    HornetQConnectionFactory.createQueueConnection won't close on System.exit()

    hughbragg

      The call to HornetQConnectionFactory.createQueueConnection() isn't stopped by calling System.exit() or Runtime.halt()

       

      If a parent thread calls System.exit() or Runtime.halt() while a child thread is calling HornetQConnectionFactory.createQueueConnection, the system does not stop until the hornetQ call times out.

       

      I tested this with a firewall enabled. Trying to make a connection to the Server from the client causes the client to throw java.net.SocketTimeoutException.

       

      This makes the shutdown process on the client very unresponsive and means the hornetq threads responsible for connecting are not daemon threads.

       

      If I try to connect to a queue and I have the wrong address or the server's network connection isn't setup yet, I want to be able to stop the client immediately and not have to wait for it to timeout.

       

      Isn't this an anti pattern? Shouldn't all these threads be daemon threads? How can I force the thread to terminate without waiting?