Background
The web application calls the stored procedure to intensively update the database. The corresponding part of web.xml been updated to four hours:
<session-config> <session-timeout>240</session-timeout> </session-config>
Technologies available for the solution include Java 1.4.2, Struts 2, Tomcat 5.5, and Apache. Most other technologies (such as jQuery) are not allowed.
Problem
The update takes about an hour, but the configuration value of four hours complies with corporate standards (for good reason). A four-hour configuration is not permitted during production.
Question
What ensures that the query does not expire during the database upgrade?
Ideas
My problem in the first two cases is that the spawned process will eventually be killed by the Servlet container.
Page Refresh
- Create a database update process as a background task.
- The servlet is constantly updating the page to check completion.
Javascript ping
- Create a database update process as a background task.
- There is JavaScript code on which the ping server has been on for some time.
Similarly, Preventing a session timeout for long processing time in JSF , but without jQuery.
Update server
Write a simple server that listens for requests:
- The servlet sends the request to the listener.
- The listener starts the update.
Because the server is independent of Tomcat, a session timeout cannot occur. Database update will be completed without loss. This has numerous problems (error handling is not least my concern) and is probably the last resort.
Optimization
Optimizing the request for completion in less than 30 minutes (maximum timeout) is possible, but most likely the request cannot be optimized enough.
Equipment
Unfortunately, updating the database hardware is not an option.
Thank you very much!
java tomcat session-timeout
Dave Jarvis May 11 '11 at 8:34 a.m. 2011-11-11 08:34
source share