7 Replies Latest reply on Feb 26, 2010 12:45 PM by Bill Schwanitz

    TopicConnection.close() Hangs When Reconnect Attempts = -1

    Bill Schwanitz Newbie

      Hi,

       

      Here is the code snippet:

       

      // Setting up the listener

      HornetQConnectionFactory

      hornetQConnectionFactory = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(tcPrimary, tcBackup);

      hornetQConnectionFactory.setReconnectAttempts(-1);

       

      TopicConnection topicConnection = hornetQConnectionFactory.createTopicConnection();

      TopicSession topicSession =

      topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);

       

      Topic topic = topicSession.createTopic(topicName);

       

      TopicSubscriber topicSubscriber = topicSession.createSubscriber(topic);

       

      topicSubscriber.setMessageListener(

      this);

       

       

      topicConnection.start();

      .

      .

      .

      // Stopping the listener

      topicConnection.close()

       

       

      If I shutdown the server between the start() and the close(), the close hangs forever. Other than setting reconnect attempts to something other than -1 is there a way to get the close to succeed?

       

      Thanks,

      Bill