• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet timing out

 
rajesh mehra
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
rajesh mehra
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic