• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Will servlet continue to run after session out?

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Stephen Wei
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello:
plz check web.xml file , and check <session timeout tag>
 
Arun Boraiah
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Stephen Wei
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Saloon Keeper
Posts: 28323
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't sweat petty things, or pet sweaty things. But cuddle this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic