Forced accept.
Computer101
EE Admin
Main Topics
Browse All TopicsHi
I have a java servlet which accesses a stateless EJB on JBoss on a remote server, using code
like
Object objref = initial.lookup("TestBean")
CalculatorRemoteHome home = (TestRemoteHome) PortableRemoteObject.narro
TestRemote echo = home.create();
int retval=echo.do_long_reques
I want to set a timeout on the method "do_long_request"
ie
1) Request data from ejb
2) if ejb requires more the say 30 seconds to process request and send back result data to client then
timeout on the client side and show a kind of "request took too long" error page.
Is is possible to set such a timeout , either by a config file setting or programatically?
Thanks in advance
brian sweeney
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: rama_krishna580Posted on 2007-10-04 at 08:24:58ID: 20014934
Hi,
1. EJB invocations are synchronous. You cannot control the time interval for which the thread blocks before sending the response since this is something that's determined purely by the container. Some containers, like BEA's WLI provides you some control over EJB transaction timeout intervals by exposing configurable parameters like trans-timeout-seconds for their container.
2. The ejbTimeout() method is completely unrelated to transaction timeout or execution timeout. It is used with the EJB timer service introduced in EJB 2.1, which provides a way to schedule invocations on a given EJB to occur at specific times in the future.
3. WAS provides a mechanism for setting the transaction timeout. However, the transaction timing out does NOT interrupt the bean from executing -- it is not possible in Java to interrupt an executing thread from another thread (this is a JDK restriction that applies across all vendors). The transaction timing out means that when the bean method does complete, any work performed during that transaction will be rolled back at that time.
i hope this helps you...
R.K