Search code examples
javawebsphereejb-3.0jndiwebsphere-7

How to setup timeout for ejb lookup in websphere 7.0


I have developed a standalone Javase client which performs an EJB Lookup to a remote server and executes its method.The Server application is in EJB 3.0

Under some strange magical but rare situations my program hangs indefinetly, on looking inside the issue it seems that while looking up the ejb on the server, I never get the response from the server and it also never times out.

I would like to know if there is a property or any other way through which we can setup the lookup time in client or at the server side.


Solution

  • There is a very nice article that discusses ORB configuration best practices at DeveloperWorks here. I'm quoting the three different settings that can be configured at client (you, while doing a lookup and executing a method at a remote server);

    • Connect timeout: Before the client ORB can even send a request to a server, it needs to establish an IIOP connection (or re-use an existing one). Under normal circumstances, the IIOP and underlying TCP connect operations should complete very fast. However, contention on the network or another unforeseen factor could slow this down. The default connect timeout is indefinite, but the ORB custom property com.ibm.CORBA.ConnectTimeout (in seconds) can be used to change the timeout.

    • Locate request timeout: Once a connection has been established and a client sends an RMI request to the server, then LocateRequestTimeout can be used to limit the time for the CORBA LocateRequest (a CORBA “ping”) for the object. As a result, the LocateRequestTimeout should be less than or equal to the RequestTimeout because it is a much shorter operation in terms of data sent back and forth. Like the RequestTimeout, the LocateRequestTimeout defaults to 180 seconds.

    • Request timeout: Once the client ORB has an established TCP connection to the server, it will send the request across. However, it will not wait indefinitely for a response, by default it will wait for 180 seconds. This is the ORB request timeout interval. This can typically be lowered, but it should be in line with the expected application response times from the server.