1 Reply Latest reply on Apr 16, 2007 5:31 PM by pgervais

    JBoss Messaging client app fails to reconnect after restart

    pgervais

      There seem to be a cleanup problem with the client JBoss Messaging QueueConnection.

      When following these steps, everything works fine:
      1. create a QueueConnection
      2. create a QueueSender
      3. send a message
      4. create QueueReceiver (on the same queue as the QueueSender)
      5. receive the sent message
      6. close the connection
      7. shutdown the JBoss server
      8. restart the JBoss server
      9. execute step 1-6
      Everything work fine

      But following these steps:
      1. create a QueueConnection
      2. create a QueueSender
      3. send a message
      4. create QueueReceiver (on the same queue as the QueueSender)
      5. receive the sent message
      6. shutdown the JBoss server
      7. close the connection (I get an exception, it should be normal)
      8. restart the JBoss server
      9. execute step 1, I get an exception, this should not be normal

      After investigating, I think that the problem happens when the close is executed in the second case. It seems that an exception is thrown before all the cleanup has been done, because I see a thread named WorkerThread#1[142.117.14.44:3421] (which is my machine address and what seems to be the port on which the thread is listening). That thread was not present in the first case, it disappeared after executing close on the QueueConnection.

        • 1. Re: JBoss Messaging client app fails to reconnect after rest
          pgervais

          After further investigation, it seems that the problem is due to a cleanup problem with the org.jboss.remoting.InvokerRegistry. The client invoker and server invoker from the previously created connection are not cleaned when the close method fails. I modified my code to clean this up manually
          using the following code before trying to recreate a connection:

           ServerInvoker[] serverInvokers = InvokerRegistry.getServerInvokers();
           for (ServerInvoker invoker : serverInvokers)
           {
           invoker.stop();
           invoker.destroy();
           InvokerRegistry.destroyServerInvoker(invoker);
           }
           ClientInvoker[] clientInvokers = InvokerRegistry.getClientInvokers();
           for (ClientInvoker invoker : clientInvokers)
           {
           InvokerRegistry.destroyClientInvoker(invoker.getLocator(), null);
           }
          

          and the connection could be created without stopping my application, this also took care of the WorkerThread that I mentionned in my previous post.