tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Wall <>
Subject Re: TC 6.0.20 - how to know session restored on restart?
Date Sun, 09 Aug 2009 21:23:52 GMT

> work well enough for me.  We already stored some info in the session 
> so that we could also determine the user who is associated with the 
> session among others, so we just created an object to hold this info 
> and it implements HttpSessionActivationListener and sure enough, on 
> tomcat restart, it gets called so I can rebuild the list.

Well, I cheered too soon....  Tomcat appears to be able to reactivate 
sessions even before my listeners are installed and my context has been 
initialized, meaning, I get these session object activations "too early" 
for my app to handle them.  Here's my log showing the "did activate" 
method being called before my context and session listeners were even 
instantiated by Tomcat:

On shutdown, we see the session being passivated:

2009-08-09 14:10:32,328 DEBUG 
SessionTracker.SessionInfo() - Session will passivate: 
2009-08-09 14:10:32,344 DEBUG 
( ContextListener() 
contextDestroyed: /test

On restart, we see the session be activated before the context is 
instantiated or initialized:

2009-08-09 14:10:41,188 DEBUG 
SessionTracker.SessionInfo() - Session did activate: 
2009-08-09 14:10:41,594 DEBUG 
( ContextListener() instantiated
2009-08-09 14:10:41,594 DEBUG 
( SessionListener() instantiated
2009-08-09 14:10:41,610 INFO  (OpenESignForms) 
Application.loadOpenesignformsProperties() successfully loaded 
properties from: openesignforms
2009-08-09 14:10:41,766 DEBUG 
( ContextListener() 
contextInitialized: /test

The line shows Tomcat giving me the session did activate, and the second 
line shows my context/session listeners being instantiated by Tomcat, 
and the final line is emitted when my context listener completes 
contextInitialized().  This must be a multi-thread timing issue because 
I had not had this happen on several other restarts.  Does this behavior 
make sense that Tomcat resumes passivated sessions before it even sets 
up the context?   I'm sure I can store them until my context is 
initialized, but the order sounds off to me.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message