Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How to avoid session time-out when performing time-consuming operation

Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm writing an action which updates hundreds of thousands of records in database, and pass the result to a JSP page using ActionMessage. Because the operation may take quite a long time, the session may time-out before the update finishes. The result page requires authentication, so the timed out session will cause the loss of authentication information and the result page will fail to display. Is there any solution to solve this problem, if I'm only possible to change the action itself (the result page will be used by some other actions so it will be hard to change)?
Posts: 9615
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Struts 2 provides the ExecuteAndWaitInterceptor, which displays a wait page while the time-consuming operation runs on its own thread. I believe it is implemented by polling the server, so it should prevent the session from timing out.
Another solution I've seen is that the user's request returns a "we'll be in touch" page immediately and the time-consuming operation is executed in another process which emails the user when it completes.
Please do not shoot the fish in this barrel. But you can shoot at this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic