tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kal Govindu" <>
Subject RE: Persistent Sessions
Date Mon, 04 Aug 2003 19:23:39 GMT
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.


SessionListener: --Invalidating all exisiting Session!
SessionListener: ----Removing session : null

Code for Listener:

    public void sessionCreated(HttpSessionEvent event) {

        log("sessionCreated('" + event.getSession().getId() + "')");
        Iterator i = sessions.iterator();
        log("---Collection Contains---");
        while ( i.hasNext() ){
            log (((HttpSession);

    public void sessionDestroyed(HttpSessionEvent event) {

        log("sessionDestroyed('" + event.getSession().getId() + "')");
        Iterator i = sessions.iterator();
        log("---Collection Contains---");
        while ( i.hasNext() ){
            log (((HttpSession);

    public void contextInitialized(ServletContextEvent event) {

        this.context = event.getServletContext();

    public void contextDestroyed(ServletContextEvent event) {

        log("--Invalidating all exisiting Session!");
        Iterator i = this.sessions.iterator();
        while (i.hasNext()){
            HttpSession s = (HttpSession);
            log("----Removing session : " + s.getId());
        this.context = null;


-----Original Message-----
From: Shapira, Yoav []
Sent: Monday, August 04, 2003 11:13 AM
To: Tomcat Users List
Subject: RE: Persistent Sessions

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 []
>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.
>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.
><Manager className="org.apache.catalina.session.PersistentManager"
>              debug="0"
>              saveOnRestart="false"
>              maxActiveSessions="-1"
>              minIdleSwap="-1"
>              maxIdleSwap="-1"
>              maxIdleBackup="-1">
>                <Store
>          </Manager>
>To unsubscribe, e-mail:
>For additional commands, e-mail:

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:
For additional commands, e-mail:

View raw message