• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Mock question regarding session

 
Ranch Hand
Posts: 485
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
i came across the below question.
i doubt more than one answer is right. can any one explain which is right option.

In which of the following situations will a session be definitely invalidated?

Select 2 correct options.

1) The container is shutdown and brought up again.
2) No request comes from the client for more than "session timeout" period.
3) A servlet explicitly calls invalidate() on a session object.
4) If the session time out is set to 0 using setMaxInactiveInterval() method,
the session will never be invalidated automatically.
 
Ranch Hand
Posts: 380
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Answer 2 &3 :
2) No request comes from the client for more than "session timeout" period.
3) A servlet explicitly calls invalidate() on a session object.

Regards,
Shivani
 
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

2) No request comes from the client for more than "session timeout" period



I don't understand why 2 is correct. I think for it to be correct it should be worded correctly (in terms of grammer and syntax). For it to be correct, it should be worded as follows (for e.g.):

2) No request comes from the client

You just can't talk apple and oranges. I mean you can't talk request and period. This is because request is not a form of time (period).

Please correct me if I am wrong.
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

2) No request comes from the client



Question is till when container will wait for request for client, before it decides to invalidate the session being create for that client.

Here 'Session Timeout' comes into picture. Container will wait till 'Session Timeout' time and if no request comes from Client till then, Session is invalidated.

Hope it helps
 
reply
    Bookmark Topic Watch Topic
  • New Topic