1 Reply Latest reply on Jul 9, 2004 11:19 PM by adrian.brock

    createQueueSession - causing timeout

    spyer

      Trying to create a queuesession to a remote queue, context lookup is acceptable but the createQueueSession is taking a long time and is timing out, can anyone help.

      Hashtable env = new Hashtable();
      env.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
      env.put("java.naming.provider.url", "remote_host:1099");
      env.put("java.naming.factory.url.pkgs","org.jboss.naming");
      InitialContext ctx = new InitialContext(env);
      System.out.println("1 : "+new Date());
      QueueConnectionFactory qfc = (QueueConnectionFactory) ctx.lookup("ConnectionFactory");
      System.out.println("2 : "+new Date());
      QueueConnection queConn = qfc.createQueueConnection();
      System.out.println("3 : "+new Date());
      Queue que = (Queue) ctx.lookup("queue/ResultsQ4"); // q relevant to session id
      System.out.println("4 : "+new Date());
      QueueSession session = queConn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
      System.out.println("5 : "+new Date());
      queConn.start();
      System.out.println("6 : "+new Date());

      results :

      1 : Fri Jul 09 17:05:12 BST 2004
      2 : Fri Jul 09 17:05:12 BST 2004
      3 : Fri Jul 09 17:05:13 BST 2004
      4 : Fri Jul 09 17:05:13 BST 2004
      5 : Fri Jul 09 17:05:34 BST 2004
      6 : Fri Jul 09 17:05:34 BST 2004

        • 1. Re: createQueueSession - causing timeout

           

          
           public Session createSession(boolean transacted, int acknowledgeMode) throws JMSException
           {
           if (closed)
           throw new IllegalStateException("The connection is closed");
           checkClientID();
          
           if (transacted)
           acknowledgeMode = 0;
           Session session = new SpySession(this, transacted, acknowledgeMode, false);
          
           //add the new session to the createdSessions list
           synchronized (createdSessions)
           {
           createdSessions.add(session);
           }
          
           return session;
           }
          


          The checkClientID() is the only part that does any work. It contacts the server to
          get the next client id.
          If this is taking 20 seconds, your network connection is fscked,
          my first guess would be a dodgy DNS server.