Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In our web application, for each http-request there is a lot of computation that happens on back end. Output can vary from 10 sec - 1 Hour. In the mean time when it is computed, "Waiting.." is shown on the website for the respective user.

But it so happens, that a user might cut down the service in between. So what all can be done on the back end so that the computation can be stopped in between to save resources? What different tactics can be applied here?

And if better (instead of killing the thread directly), then a graceful termination policy should make wonders.

This is using Java - spring jdbc and portlets. Though if it can be shown even for a servlet, I can replicate that to others.

share|improve this question

closed as off topic by paulmorriss Sep 12 '12 at 11:58

Questions on Webmasters Stack Exchange are expected to relate to webmastering within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

What is this implemented in? PHP? If so, the default configuration tells the server to abort the script on user-exit (browser close). This CAN be overridden, like this: ignore_user_abort(true);set_time_limit(0); which means "don't kill the script if a user exits, and run it for forever seconds" (Change 0 to however many seconds you want it to run maximum). – ionFish Sep 12 '12 at 10:45
This question belongs at serverfault.com but I need more information from you on the technology involved before I would consider moving it there. – paulmorriss Sep 12 '12 at 11:18
@ionFish No. Java – Jatin Sep 12 '12 at 11:26
@paulmorriss Thanks. Sorry I wasn't aware. Spring jdbc and portlets. Though if it can be shown even for a servlet, I can replicate that to others. – Jatin Sep 12 '12 at 11:27
Actually, it's a better fit for Stackoverflow, but is too vague. – paulmorriss Sep 13 '12 at 14:16