arooj_aftab
asked on
Question for EJB Expert
I have an EJB application which is connected to a web site. The website is
developed using JSPs & Servlets.
Most of the JSPs have two buttons.
One to submit the information and the second to reset the information.
When the user clicks on the submit button, the information goes to EJB
through a servlet. It takes almost 8 seconds for the EJBs to save the
information.
During these 8 seconds, if the user clicks on the reset button, I want
to stop the EJB from doing all the processing, transaction, etc... and
rollback everything.
Is there any way to do this ? Any pointers, URLs, references to any other
resource would be greatly appreciated.
developed using JSPs & Servlets.
Most of the JSPs have two buttons.
One to submit the information and the second to reset the information.
When the user clicks on the submit button, the information goes to EJB
through a servlet. It takes almost 8 seconds for the EJBs to save the
information.
During these 8 seconds, if the user clicks on the reset button, I want
to stop the EJB from doing all the processing, transaction, etc... and
rollback everything.
Is there any way to do this ? Any pointers, URLs, references to any other
resource would be greatly appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
1) Make sure you have Stateful session bean EJBs
2) Start doing the event when user clicks go button.. AT each step, check the flag inside the EJB -- boolean cancelled;
3) If cancelled is true, then rollback (easiest way is to throw a RemoteException if you are using CMT)
Then, the cancel button can call the setCancelled() method inside the session EJB, setting it to true, and forcing the other process to stop...
Of course, both calls will have to go to the same session bean... Maybe cache remote handles inside the session for the current user in the webapp?
Hope this helps... Just some thoughts...
It's a tricky thing that most people skirt around...
Tim