You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Clute, Andrew" <An...@osn.state.oh.us> on 2005/04/05 22:20:00 UTC

HttpSessionListener events after redeployment?

In my application I like to keep track of all the sessions that are
currently active. So, I have a class that implements HttpSessionListener
and have a static HashMap that keeps a reference to all the active
sessions.
 
Everything works great. I get the events, and can track them without any
issues.
 
My problem arises when I redeploy my application. My sessions serialize
just fine, and recreate ok as well. However after redeployment, I have
no references to the active sessions (since my static Map has been
destroyed). 
 
Are there any events I can listen for when a session is recreated from
serialization? I was hoping for HttpSessionListener.sessionCreated(),
but that doesn't happen, and I can understand why. Maybe there is a
cleaner way to get a reference to all of the sessions active on my
server that will survive serialization?
 
Thanks in advance!
 
-Andrew

Re: HttpSessionListener events after redeployment?

Posted by Mark Thomas <ma...@apache.org>.
Have a look at javax.servlet.http.SessionActivationListener

Clute, Andrew wrote:
> In my application I like to keep track of all the sessions that are
> currently active. So, I have a class that implements HttpSessionListener
> and have a static HashMap that keeps a reference to all the active
> sessions.
>  
> Everything works great. I get the events, and can track them without any
> issues.
>  
> My problem arises when I redeploy my application. My sessions serialize
> just fine, and recreate ok as well. However after redeployment, I have
> no references to the active sessions (since my static Map has been
> destroyed). 
>  
> Are there any events I can listen for when a session is recreated from
> serialization? I was hoping for HttpSessionListener.sessionCreated(),
> but that doesn't happen, and I can understand why. Maybe there is a
> cleaner way to get a reference to all of the sessions active on my
> server that will survive serialization?
>  
> Thanks in advance!
>  
> -Andrew
> 


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


Re: HttpSessionListener events after redeployment?

Posted by Joe Riopel <go...@gmail.com>.
Could you use the isNew() method from HttpSession ?

On Apr 5, 2005 4:20 PM, Clute, Andrew <An...@osn.state.oh.us> wrote:
> In my application I like to keep track of all the sessions that are
> currently active. So, I have a class that implements HttpSessionListener
> and have a static HashMap that keeps a reference to all the active
> sessions.
> 
> Everything works great. I get the events, and can track them without any
> issues.
> 
> My problem arises when I redeploy my application. My sessions serialize
> just fine, and recreate ok as well. However after redeployment, I have
> no references to the active sessions (since my static Map has been
> destroyed).
> 
> Are there any events I can listen for when a session is recreated from
> serialization? I was hoping for HttpSessionListener.sessionCreated(),
> but that doesn't happen, and I can understand why. Maybe there is a
> cleaner way to get a reference to all of the sessions active on my
> server that will survive serialization?
> 
> Thanks in advance!
> 
> -Andrew
> 
>

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