costin      01/08/31 17:56:37

  Modified:    src/share/org/apache/tomcat/modules/session
                        SimpleSessionStore.java
  Log:
  A tiny improvement in session reloading, objects that implement valueUnbound but can 
be
  serialized will not be unbounded, but preserved.
  
  Sessions will be recycled after EXPIRE state is 'stable' ( i.e. all modules complete 
all the
  associated hooks).
  
  Set debug on new sessions based on our own debug level - so setting debug="1" on the
  session store ( which creates and manages the session storage ) will enable debug on
  the session activities as well.
  
  Revision  Changes    Path
  1.18      +18 -4     
jakarta-tomcat/src/share/org/apache/tomcat/modules/session/SimpleSessionStore.java
  
  Index: SimpleSessionStore.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/session/SimpleSessionStore.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- SimpleSessionStore.java   2001/08/24 02:24:19     1.17
  +++ SimpleSessionStore.java   2001/09/01 00:56:37     1.18
  @@ -123,8 +123,6 @@
        while( sessionEnum.hasMoreElements() ) {
            ServerSession session = (ServerSession)sessionEnum.nextElement();
   
  -         session.setState( ServerSession.STATE_SUSPEND, req );
  -         
            ClassLoader oldLoader=(ClassLoader)ctx.getContainer().
                getNote("oldLoader");
   
  @@ -144,7 +142,19 @@
                    newSession.put( key, newValue );
                } 
            }
  +         // Remove all objects we know how to handle
  +         e=newSession.keys();
  +         while( e.hasMoreElements() )   {
  +             String key = (String) e.nextElement();
  +             session.removeAttribute(key);
  +         }
   
  +         if( debug > 0 ) log("Prepare for reloading, SUSPEND " + session );
  +         // If anyone can save the rest of the attributes or at least notify
  +         // the owner...
  +         session.setState( ServerSession.STATE_SUSPEND, req );
  +         
  +         if( debug > 0 ) log("After reloading, RESTORED " + session );
            session.setState( ServerSession.STATE_RESTORED, req );
   
            /* now put back all attributs */
  @@ -336,7 +346,9 @@
            sessions.remove(session.getId().toString());
            recycled.put(session);
            session.setValid(false);
  -         session.recycle();
  +         // Do not recycle it yet - whoever expires it should also recyle.
  +         // Otherwise we may miss something
  +         // session.recycle();
            //      session.removeAllAttributes();
        }
   
  @@ -346,11 +358,12 @@
            if (session == null) {
                session = ctx.getContextManager().createServerSession();
                session.setManager( this );
  +             session.setDebug( debug );
            }
            session.setContext( ctx );
   
            session.setState( ServerSession.STATE_NEW, req );
  -
  +         
            // The id will be set by one of the modules
            String newId=session.getId().toString();
            
  @@ -365,6 +378,7 @@
            if( oldS!=null) {
                // that's what the original code did
                oldS.setState( ServerSession.STATE_EXPIRED );
  +             oldS.recycle();
            }
            sessions.put( newId, session );
            return (session);
  
  
  

Reply via email to