3 Replies Latest reply on Apr 25, 2006 3:42 AM by Hubert Iwaniuk

    lookup time slow at first time

    stephen zeng Newbie

      public TestHotelOrderService() throws NamingException{
      InitialContext ic = new InitialContext();
      long start=System.currentTimeMillis();
      session = (HotelOrderService.Remote) ic.lookup("btoss/HotelOrderServiceBean/remote");
      long end=System.currentTimeMillis();
      System.out.println("lookup time1 "+(end-start)/1000.00);

      start=System.currentTimeMillis();
      dao=(DaoService.Remote) ic.lookup("btoss/DaoServiceBean/remote");
      end=System.currentTimeMillis();
      System.out.println("lookup time2 "+(end-start)/1000.00);

      }

      version:JBoss_4_0_4_CR2
      Result:
      lookup time1=15.25 second
      lookup time2= 0.016 second

      Question:
      why the lookup time at first time so long inside a construct method? The time for lookuping local reference is as long as remote at first time when I new an new InitialContext();
      If I do not cache remote reference, any other way to reduce lookup time?

      Stephen