File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes servlet timing out Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet timing out" Watch "servlet timing out" New topic
Author

servlet timing out

rajesh mehra
Greenhorn

Joined: May 13, 2003
Posts: 4
Hi people,
I was working on a problem where I have to let the users know that their database query and/or session is going to timeout and they are going to get a "page not found" error.
What can I do in the servlet to capture that the page is not going to return and let the users know.
Thanks,
Rajesh
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12678
    
    5
You will have to run the database query or whatever the time consuming operation is in a separate Thread - presumably in something like a JavaBean that implements Runnable.
Keep in mind that servlets only respond to requests and can't just arbitrarily send a page.
Bill


Java Resources at www.wbrogden.com
rajesh mehra
Greenhorn

Joined: May 13, 2003
Posts: 4
Thank you,
I just needed a little more clarification. If I run the query in a seperate thread, then it will not time out and keep running in the background (say for half an hour) and in the meantime I can display to the user that his report is executing and he should wait.
I have an option where the user can get the web report by email too (am using a seperate thread).
So now that the web report never times out, the only thing I can do is to calculate the time at regular intervals and if it exceeds a certain time, display to the user that it is taking too long and maybe he should try email instead.
Please let me know if I am missing something.
Thank you,
Rajesh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: servlet timing out
 
Similar Threads
Dynamic forms and pages
performance issues with file read and write
how does the servlet knows that the client has closed the browser
call a servlet/Filter during refresh ?
Cannot find ActionMappings or ActionFormBeans