• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Program Cannot Display the Webpage error for Long running process

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's a link to an earlier Ranch post which discusses that same problem: https://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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic