Interrupting a Stateful Session Bean


General J2EE: Interrupting a Stateful Session Bean

  1. Interrupting a Stateful Session Bean (1 messages)


    I have a Servlet that uses a Stateful Session Bean that does very lengthy db operations. While the db operation is in progress, if a user clicks on the stop button any subsequent use of the site results in

    java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:

    The way we've written our code is we get a handle to the EJB object once for each user that logs in and use the same handle for their entire stay. My thinking is that since stateful session beans are attached to only one thread and are not reentrant, the Servlet thread that was interrupted (user clicked the stop button) never cleaned itself up and still has a hook into the EJB object.

    So, my question is how can I catch the stop button event and clean things up?

    Any ideas?

  2. Interrupting a Stateful Session Bean[ Go to top ]

    U can use ActionHandler and inside that u can deset the handle u had acquired, or u can remove the handle by setting it to null. Ofcourse care should be taken that a new user should be able to locate the EJB handle.