Hi Yoav,
Thank you for you suggestion, I have it implemented and seem to be
having some problem with it. Below is the code I have in my listener. I
have collection of Session Objects and I am adding an removing the
Sessions from the collection as required but, when I get to my
contextDestroyed method and try to invalidate all the remaining session
, I get the message listed below in log.
Thanks for all your help.
Kal
Log:
SessionListener: --Invalidating all exisiting Session!
SessionListener: ----Removing session : null
Code for Listener:
public void sessionCreated(HttpSessionEvent event) {
sessions.add(event.getSession());
log("sessionCreated('" + event.getSession().getId() + "')");
Iterator i = sessions.iterator();
log("---Collection Contains---");
while ( i.hasNext() ){
log (((HttpSession)i.next()).getId());
}
}
public void sessionDestroyed(HttpSessionEvent event) {
sessions.remove(event.getSession());
log("sessionDestroyed('" + event.getSession().getId() + "')");
Iterator i = sessions.iterator();
log("---Collection Contains---");
while ( i.hasNext() ){
log (((HttpSession)i.next()).getId());
}
}
public void contextInitialized(ServletContextEvent event) {
this.context = event.getServletContext();
log("contextInitialized()");
}
public void contextDestroyed(ServletContextEvent event) {
log("--Invalidating all exisiting Session!");
Iterator i = this.sessions.iterator();
while (i.hasNext()){
HttpSession s = (HttpSession)i.next();
log("----Removing session : " + s.getId());
s.invalidate();
}
log("contextDestroyed()");
this.context = null;
}
-----Original Message-----
From: Shapira, Yoav [mailto:[EMAIL PROTECTED]
Sent: Monday, August 04, 2003 11:13 AM
To: Tomcat Users List
Subject: RE: Persistent Sessions
Howdy,
Consider a container-independent approach instead: write an
HttpSessionListener that's also a ServletContextListener. Have it keep
a static list of HttpSession objects, adding the session to the list on
its creation and removing on its destruction. Then, have the
contextDestroyed method go through the list and invalidate all the
remaining sessions.
Yoav Shapira
Millennium ChemInformatics
>-----Original Message-----
>From: Kal Govindu [mailto:[EMAIL PROTECTED]
>Sent: Monday, August 04, 2003 11:09 AM
>To: Tomcat Users List (E-mail)
>Subject: Persistent Sessions
>
>I am trying to clean-up ( invalidate ) all the session when Tomcat is
>restarted for any reason. I have the following Tag in my server.xml.
The
>session created for my web application still seem to persist, is there
>another place or way the session is being store or persisted?
>
>Please help, thanks in advance.
>Kal
>
><Manager className="org.apache.catalina.session.PersistentManager"
> debug="0"
> saveOnRestart="false"
> maxActiveSessions="-1"
> minIdleSwap="-1"
> maxIdleSwap="-1"
> maxIdleBackup="-1">
> <Store
>className="org.apache.catalina.session.FileStore"/>
> </Manager>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential,
proprietary and/or privileged. This e-mail is intended only for the
individual(s) to whom it is addressed, and may not be saved, copied,
printed, disclosed or used by anyone else. If you are not the(an)
intended recipient, please immediately delete this e-mail from your
computer system and notify the sender. Thank you.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]