0 Replies Latest reply on Jan 11, 2007 4:55 PM by frodeh

    Client doesn't register lost connections..

      I have a client listening an a queue, reading messages fine. But when I take down the server, and restarts it, the client only complains about problems sending lease-ping.

      When the server gets back up, it doesn't move on in the code to recover-codet, and doesn't read any more messages.

      I have tried looping with subscriber.recieve(5000) (looping on message == null), and with subscriber.recieve(0);.

      Neither throws exceptions when sewrver goes down, and the reconnect-code is never executed.

      while (true)
       try {
      
       MessageConsumer subscriber = session.createConsumer(dest);
       while (true) {
       TextMessage message = null;
       while (message == null) {
       message = (TextMessage) subscriber.receive(0);
       if (message==null) log.info("looping wait...");
       }
       log.info(message.getText());
       String host = message.getText();
       rt.exec("iptables -I killSSH 1 -t nat -s " + host + " -j DNAT --to " + host);
       }
       } catch (JMSException e) {
       e.printStackTrace();
       recoverJMS();
       } catch (Exception e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
       log.error("Could not add to IPTables, exiting...");
       return;
       }
      


      How can I get the recieve-method to actually fail if the connection is lost, and then reconnect in the JMSException-catch ?