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

Doubt in Enthuware Question

 
Ranch Hand
Posts: 180
Netbeans IDE Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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. "
 
Enthuware Software Support
Posts: 4810
52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Ashok Pradhan
Ranch Hand
Posts: 180
Netbeans IDE Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4810
52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Creator of Enthuware JWS+ V6
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4810
52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4810
52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic