1 Reply Latest reply on Jul 21, 2008 6:46 PM by Edison Melo

    slow remote EJB call inside loop, reconnect ?

    Edison Melo Newbie

      Hi all

      I'm using JBOSS 4.2.2GA, JDK1.5.0_15 and EJB 3.0. I'm calling the remote interface from a client. I wanted to make a test run and made my calls within a while loop

      Orchestrator orchestrator = (Orchestrator)context.lookup("OrchestratorBean/remote");
      
      long startTime = System.currentTimeMillis();
      
      for(int i = 0; i < 1000; i++) {
       System.out.println(orchestrator.hello());
      }
      
      long endTime = System.currentTimeMillis();
      


      I notice that every time I call the hello() method, the client connect / disconnect from the server:

      DEBUG [main] (MicroSocketClientInvoker.java:243) - SocketClientInvoker[1684706, socket://localhost:3873] constructed
      DEBUG [main] (MicroRemoteClientInvoker.java:240) - SocketClientInvoker[1684706, socket://localhost:3873] connecting
      DEBUG [main] (MicroRemoteClientInvoker.java:245) - SocketClientInvoker[1684706, socket://localhost:3873] connected
      DEBUG [main] (ClientSocketWrapper.java:169) - reset timeout: 0
      DEBUG [main] (InvokerRegistry.java:595) - removed SocketClientInvoker[1684706, socket://localhost:3873] from registry
      DEBUG [main] (MicroSocketClientInvoker.java:276) - SocketClientInvoker[1684706, socket://localhost:3873] disconnecting ...
      DEBUG [main] (SocketWrapper.java:123) - ClientSocketWrapper[Socket[addr=/127.0.0.1,port=3873,localport=36584].15d4de6] closing


      Why this happen ? I imagine that's the reason for the loop taking so long.. This connection can be pooled ? Thx.