java - Prevent session timeout during database update -


background

a web application calls stored procedure perform intensive database update. relevant portion of web.xml updated 4 hours:

<session-config>     <session-timeout>240</session-timeout> </session-config> 

the technologies available solution include java 1.4.2, struts 2, tomcat 5.5, , apache commons. other technologies (such jquery) not permitted.

problem

the update takes hour run, configuration value of 4 hours against corporate standards (for reason). 4 hour timeout configuration not permitted in production.

question

what ensure request not time out while database update executes?

ideas

my concern in first 2 cases spawned process killed servlet container.

page refresh

  1. spawn database update process background task.
  2. have servlet continually refresh page check completion.

javascript ping

  1. spawn database update process background task.
  2. have javascript code ping server while.

similar preventing session timeout during long processing time in jsf, without jquery.

update server

write simple server listens requests:

  1. the servlet sends request listener.
  2. the listener runs update.

since server runs independently of tomcat, session timeout cannot occur. database update run completion without being killed. has numerous issues (error handling not least of concern) , option of last resort.

optimization

optimizing query finish in under 30 minutes (the maximum permitted timeout) possible, query cannot optimized sufficiently.

hardware

upgrading database hardware not option, unfortunately.

many thanks!

in opinion, no user want sit in front of screen monitoring background job 4 hours. few years ago, had implement report generation took hours. implemented solution following:

  • generate report in background thread. thread monitored , available via application context list. thread contained information owner , progress.
  • users can list own threads , see progress.
  • upon completion report thread store report offline access, send email notification owner link download generated report.

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -