0 Replies Latest reply on Apr 18, 2008 3:09 PM by 666705

    Does weblogic.jndi.Environment.setRequestTimeout work?

    666705
      Hi,

      I'm using WLS 9.2 MP1 with Sun Java 1.5.0_06 (on Windows XP and HP-UX).

      I would like to set the timeout for JNDI lookup operation. In case WLS is busy (for example all threads are occupied) I would like the stand-alone J2EE client connecting to this WLS to timeout on JNDI lookup operation.

      In documentation for weblogic.jndi.Environment.setRequestTimeout() we can read "Set the request timeout value in milliseconds. JNDI requests that fail to get a response within the timeout value will fail with RequestTimeoutException. A value of 0 implies that request will never timeout."

      I tried to use this method but I think it has no impact on the execution. I tried also setting parameter REQUEST_TIMEOUT from weblogic.jndi.WLContext (Forces lookup requests to timeout if the request doesn't get a response from the server within the timeout interval. The value is specified in milliseconds as a long. A value of 0 implies that requests never timeout. This property applies to the bootstrap request as well.), but it also didn't help.

      ...
      import weblogic.jndi.Environment;
      import weblogic.jndi.WLContext;

      ...
      Context ctx = null;
      Environment env = new Environment();
      env.setProviderUrl("t3://localhost:7001");

      // does it work during ctx.lookup()?
      env.setRequestTimeout(10000L);

      env.setInitialContextFactory("weblogic.jndi.WLInitialContextFactory");
      ctx = env.getInitialContext();

      // does it work during ctx.lookup()?
      ctx.addToEnvironment(WLContext.REQUEST_TIMEOUT, 10000L);

      Regardless of what I set client hangs on lookup operation until one thread become idle (it can take a long time).

      Does anyone have experience with setting timeout on JNDI lookup operation?

      Thanks in advance for any reply.
      Andrzej