Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Program Cannot Display the Webpage error for Long running process

 
Marie Augustus
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a servlet which calls a huge file generation program. The program takes around 2:30 hrs to complete.
I have increased the session timeout limit under web.xml file to 600 that is 10 hours.

Following is the code modified:
<session-config>
<session-timeout>600</session-timeout>
</session-config>

Now, the servlet getting called from the webpage expires in exact 1hour though the process of file generation successfully completes in its stipulated time of 2:30 hrs.
I need a reference id that is returned by the long running process on the user page but since it gets expired, this is not working. Note that the entire website session does not timeout, only that particular webpage expires.

Please suggest how to change this page time of 1 hour. I also heard this can be handled using dummy ajax pings from the webpage, so it returns a value to keep the session alive. I called the ajax pinging process along with the button which called long running process, but it did not help. Even after that the page expired. I think this page expiry is not related to session timeout.

The third approach could be to call an independent thread from servlet which in turn calls the long running program. But i need to use ajax approach or some other kind of approach to somehow display the id on screen when the process is finished. But donot know how to do it. Need a sample code.

I currently donot have any option to switch this entire thing as an independent background process or to decrease the processing time.

Please help.

--
Regards,
Marie Augustus.
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a link to an earlier Ranch post which discusses that same problem: http://www.coderanch.com/t/361827/Servlets/java/Long-Running-Servlet

Ben Souther's response there is a short summary of what you need to do. Later posts make the point that the user may not want to sit for several hours waiting and that sending an e-mail when the processing is complete might be something to consider.
 
Marie Augustus
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the link Paul.
However, i am new to Servlets and using threads. I can spawn a thread when the process starts but donot know how to return status of thread completion back to the main program when it ends or %completion progress.
Can you please guide me through some sample code?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic