• Post Reply Bookmark Topic Watch Topic
  • New Topic

Effect of setMaxInactiveInterval(0)

 
Nidhi Sar
Ranch Hand
Posts: 252
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to the note on page 249 of HFSJ, the effect of setMaxInactiveInterval(0) is that the session times out IMMEDIATELY

According to JEE6 API,

void setMaxInactiveInterval(int interval)
Specifies the time, in seconds, between client requests before the servlet container will invalidate this session.
An interval value of zero or less indicates that the session should never timeout.


According to JEE5 API,

void setMaxInactiveInterval(int interval)
Specifies the time, in seconds, between client requests before the servlet container will invalidate this session.
A negative time indicates the session should never timeout.

Note: Nothing about zero in here.

So my question is, in the current exam, what would be the correct answer to the question "what is the effect of setMaxInactiveInterval(0) on the session?"
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2781
174
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nidhi,
So my question is, in the current exam, what would be the correct answer to the question "what is the effect of setMaxInactiveInterval(0) on the session?"


This is what is written in the servlet2.4 spec (SCWCD5):
SRV.7.5 Session Timeouts
This timeout can be changed by the Developer using the setMaxInactiveInterval method of the HttpSession interface. The timeout periods used by these methods are defined in seconds. By definition, if the timeout period for a session is set to -1, the session will never expire.

There is nothing about 0, because if you think about it: it effectively means expire after 0 seconds.

Regards,
Frits
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!