Two Laptop Bag*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Effect of setMaxInactiveInterval(0) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Effect of setMaxInactiveInterval(0)" Watch "Effect of setMaxInactiveInterval(0)" New topic
Author

Effect of setMaxInactiveInterval(0)

Nidhi Sar
Ranch Hand

Joined: Oct 19, 2009
Posts: 252

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?"


"A problem well stated is a problem half solved.” - Charles F. Kettering
SCJP 6, OCPJWCD
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1640
    
  23

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Effect of setMaxInactiveInterval(0)
 
Similar Threads
URLConnection timeout
setMaxInactiveInterval and <session-timeout> question
when session time out doesn't occur (automatically) ?
Session Timeout
Servlet & Jsp