• Post Reply Bookmark Topic Watch Topic
  • New Topic

Session Expiring Time?  RSS feed

 
Vikrama Sanjeeva
Ranch Hand
Posts: 760
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guyz,
I am trying to allow user to set his Session time.After that time Session must expires.I am writing the pseudocode here:
1: Get the user defined time in sessionTime
2: mySession.setMaxInactiveInterval(sessionTime)
3: if(mySession==null)
out.println("Session Expired")
esle
out.println("Session Active")
Explanation:-
Step 1 is done is a 1st Servlet
Step 2 is done in a 2nd Servlet
Step 3 is done in a 3rd Servlet

A/C to me the above logic is clear.But when I run Servlet, I give i/p 1.That is 1 seconds Session time, But Session is active after 1 second and expires beore 1 minute.Why not it expires right after 1 second?.
Bye,
Viki.
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems that I read somewhere that when the time limit is reached the server will have to opportunity to invalidate the session but may not do it right away.
 
Ken Robinson
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As mentioned above, I would not expect the container to invalidate the session exactly on x number of seconds.
Most likely the container checks for timed out sessions once every X minutes. I would consult the docs of the server you are using to see if you can adjust this, or at the very least see if you can determine the value.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!