Show TOC

Background documentationLifetime of a Session Locate this document in the navigation structure

 

The lifetime of a session is marked by the session creation. A session is created in one of the following cases:

  • The client requests the servlet for the first time, and the servlet requires that a session is created.

  • The client requests the application after the session that he or she was associated with has timed out or invalidated;

After the session is being activated, information about client activities across the application is stored in it.

The end of the session lifetime is forced in some of the following cases:

  • The session is invalidated by the servlet.

  • The session timeout period that you have set for the application in the <session-timeout> tag of the deployment descriptor has passed since the session was last accessed.

    Note Note

    When you use persistent sessions, you may encounter a situation when the Web Container moves the session object to a different JVM and then activates it again (these are the cases when you use session failover). You can enable objects that are bound to the session to receive messages from the Web Container when the session is activated or passivated, if you develop them implementing the HttpSessionActivationListener interface. For more information about the methods of that interface, refer to Java Servlet 2.5 API.

    End of the note.