Reputation: 33514
Consider a tomcat server running with 10 sessions in it. These sessions were started at different times. Then server was restarted. What shall happen at server start-up? Will it "look" (or just look) up sessions which were saved to the disk ? If so, what shall happen after that?
Upvotes: 2
Views: 877
Reputation: 16615
Answering your questions in a slightly different order. This answer assumes a default Tomcat configuration - i.e. one using the StandardManager with the default options.
The persisted sessions include the last active time. When Tomcat starts, it starts each of the web applications. During web application start, a web application starts its associated session manager.
When the session manager starts, it loads the persisted sessions for that web application. As each session is loaded the session activation event will be fired. Also, the last active time is checked to see if the session needs to be expired. If it does, the session is expired at that point and Tomcat fires the standard session destroyed event.
Once the web application is started, the background thread periodically checks the session last active time and expires sessions as necessary.
Upvotes: 1