tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Wall <d.w...@computer.org>
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 
(com.esignforms.open.admin.SessionTrackerInfo) 
SessionTracker.SessionInfo() - Session will passivate: 
9260160A7F18354F635AC5519F19FC5A
2009-08-09 14:10:32,344 DEBUG 
(com.esignforms.open.servlet.ContextListener) 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 
(com.esignforms.open.admin.SessionTrackerInfo) 
SessionTracker.SessionInfo() - Session did activate: 
9260160A7F18354F635AC5519F19FC5A
2009-08-09 14:10:41,594 DEBUG 
(com.esignforms.open.servlet.ContextListener) ContextListener() instantiated
2009-08-09 14:10:41,594 DEBUG 
(com.esignforms.open.servlet.SessionListener) 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 
(com.esignforms.open.servlet.ContextListener) 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.

David


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message