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?