Hello all: Can someone please tell me what will happen in the following case? The user will submit a request to my Mail Servlet, and send out mails one by one for about 1 hour. My session out time limit is 30 minutes. After submitting the mail request, the user will go home so the session will expire after 30 minutes. My question is will the Mail Servlet continue to execute and send out all the mails? Or the Mail Servlet will stop executing after session out, so do not actually send out all the email? Which one? Thanks!
hi, First of all i need some more information regarding your mail servlet to jump to conclusion. But generally session time out means when user state is inactive (for your case 30 min of inactiveness) session get expired. This means that whatever vaules which have been put in the session will not be available. Since user will be sending there is no question of inactiveness. Thereby all the mails will be sent. -arun [ February 03, 2002: Message edited by: arun boraiah ]
Sharing is learning
Joined: Oct 09, 2001
Hi: I did not explain my servlet clearly. What happens is that after my Mail servlet receives the request from the user, it will retrieve say 700 email address from the DB(not Junk Mail!), and then send out mail message(inputed by the user) one by one in a 5 seconds interval, so the whole process takes about 1 hour. So after user submits the mail request, user will leave the screen as it is, and go home, (ie, no more activities on the client computer). So in this case, will the session expire after 30 minutes? If so, as long as my mail servlet does not use any session attributes, it will finish the whole execution? Thanks!
hi, As per the servlet concerned. it don't matter what the session time out is. It will complete the request (Since in your case no session attribute present it should). Even browser is close from client's end. Anyhow test this with very small session time say one min. -arun
Joined: Oct 09, 2001
Hi, thanks for the advice. I think test my servlet with a small session out period , say 1 minute would be a good idea. I think as long as my servlet avoid using session attributes, it should work find. Thanks
You should never attempt to execute a long-running task from a servlet or JSP. The programming maodel for these constructs is essentially the same as a subroutine call from the browser with the addition of the fact that the browser can time out or otherwise go away. Session timeouts are running against a clock that counts down from the last time a request was sent from that user to the server. For long-running tasks such as running a spamming server, you should create a stand-alone process to do the back-end work and post work requests to it from the servlet rather than have the servlet attempt to to the heavy work itself.
Customer surveys are for companies who didn't pay proper attention to begin with.