*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Doubt in Enthuware Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Doubt in Enthuware Question" Watch "Doubt in Enthuware Question" New topic
Author

Doubt in Enthuware Question

Ashok Pradhan
Ranch Hand

Joined: Dec 17, 2007
Posts: 180

In which of the following situations will a session be definitely invalidated?(You have to select 3 option)

A:The container is shutdown and brought up again.
B:No request comes from the client for more than "session timeout" period.
C:A servlet explicitly calls invalidate() on a session object.
D:If the session time out is set to 0 using setMaxInactiveInterval() method.

The answer is BC and D

My Doubt in option D because API specifies that

"A return value of zero or less indicates that the session will never timeout. "
Paul Anilprem
Enthuware Software Support
Ranch Hand

Joined: Sep 23, 2000
Posts: 3285
    
    7
As per the JavaDoc API description :
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.


Enthuware - Best Mock Exams and Questions for Oracle/Sun Java Certifications
Quality Guaranteed - Pass or Full Refund!
Ashok Pradhan
Ranch Hand

Joined: Dec 17, 2007
Posts: 180

This API Specifies "A return value of zero or less indicates that the session will never timeout. "
HttpSession

http://docs.oracle.com/javaee/6/api/

Paul Anilprem
Enthuware Software Support
Ranch Hand

Joined: Sep 23, 2000
Posts: 3285
    
    7
It seems Oracle's API description for this method is not consistent. This needs to be investigated further. But for now, I would go with the link that you are using. That seems to be more authentic. So this option should be marked incorrect.

HTH,
Paul.
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1665
    
  25

Hi Paul and Ashok,

We had this discussion earlier, have a look here for the explanation:
Session Timeout

Regards,
Frits
Paul Anilprem
Enthuware Software Support
Ranch Hand

Joined: Sep 23, 2000
Posts: 3285
    
    7
I just checked Servlet 3.0 Specification (Final) and it states:

Section 7.5 Session Timeouts

The default time out period for sessions is defined by the servlet container and can
be obtained via the getMaxInactiveInterval method of the HttpSession interface.
This time out can be changed by the Developer using the setMaxInactiveInterval
method of the HttpSession interface. The time out periods used by these methods
are defined in seconds. By definition, if the time out period for a session is set to -1,
the session will never expire.



So the answer given in our s/w is correct.
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1665
    
  25

hmmm interesting, it seems they are in the process of changing this, because in the Maintenance Release of the Servlet 3.0 specs Version 3.0 Rev a (6 February 2011),
this is written:

7.5 Session Timeouts
The default time out period for sessions is defined by the servlet container and can
be obtained via the getMaxInactiveInterval method of the HttpSession interface.
This time out can be changed by the Developer using the setMaxInactiveInterval
method of the HttpSession interface. The time out periods used by these methods
are defined in seconds. By definition, if the time out period for a session is set to 0 or
lesser value, the session will never expire.
The session invalidation will not take
effect until all servlets using that session have exited the service method. Once the
session invalidation is initiated, a new request must not be able to see that session.

Regards,
Frits
Paul Anilprem
Enthuware Software Support
Ranch Hand

Joined: Sep 23, 2000
Posts: 3285
    
    7
Frits, You are right. The same statement exists in Servlet 3.1 Early Draft ( June 2012 ) as well. So it seems they have made up their mind now. We will update the question accordingly.

thank you,
Paul.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt in Enthuware Question