Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 141
  • Last Modified:

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

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.
  • 2
1 Solution
The only way I can think of for doing this would be:

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...


Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now