You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cr...@apache.org on 2001/01/11 04:03:04 UTC

cvs commit: jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/session StandardSession.java

craigmcc    01/01/10 19:03:04

  Modified:    catalina/src/share/org/apache/catalina/session
                        StandardSession.java
  Log:
  Add debugging instrumentation to the session serialization/deserialization
  methods, so that you can validate their behavior by adding the following
  in server.xml:
  
  	<Context path="/foo" docBase="foo">
  	  <Manager debug="99"/>
  	</Context>
  
  Revision  Changes    Path
  1.10      +26 -4     jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/session/StandardSession.java
  
  Index: StandardSession.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/session/StandardSession.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- StandardSession.java	2001/01/03 00:17:08	1.9
  +++ StandardSession.java	2001/01/11 03:03:04	1.10
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/session/StandardSession.java,v 1.9 2001/01/03 00:17:08 craigmcc Exp $
  - * $Revision: 1.9 $
  - * $Date: 2001/01/03 00:17:08 $
  + * $Header: /home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/session/StandardSession.java,v 1.10 2001/01/11 03:03:04 craigmcc Exp $
  + * $Revision: 1.10 $
  + * $Date: 2001/01/11 03:03:04 $
    *
    * ====================================================================
    *
  @@ -109,7 +109,7 @@
    * @author Craig R. McClanahan
    * @author Sean Legassick
    * @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
  - * @version $Revision: 1.9 $ $Date: 2001/01/03 00:17:08 $
  + * @version $Revision: 1.10 $ $Date: 2001/01/11 03:03:04 $
    */
   
   final class StandardSession
  @@ -128,6 +128,8 @@
   
   	super();
   	this.manager = manager;
  +        if (manager instanceof StandardManager)
  +            this.debug = ((StandardManager) manager).getDebug();
   
       }
   
  @@ -165,6 +167,13 @@
   
   
       /**
  +     * The debugging detail level for this component.  NOTE:  This value
  +     * is not included in the serialized version of this object.
  +     */
  +    private transient int debug = 0;
  +
  +
  +    /**
        * We are currently processing a session expiration, so bypass
        * certain IllegalStateException tests.  NOTE:  This value is not
        * included in the serialized version of this object.
  @@ -1037,6 +1046,8 @@
   	thisAccessedTime = ((Long) stream.readObject()).longValue();
   	principal = null;	// Transient only
           setId((String) stream.readObject());
  +        if (debug >= 2)
  +            log("readObject() loading session " + id);
   
   	// Deserialize the attribute count and attribute values
   	if (attributes == null)
  @@ -1049,6 +1060,9 @@
   	    Object value = (Object) stream.readObject();
   	    if ((value instanceof String) && (value.equals(NOT_SERIALIZED)))
   		continue;
  +            if (debug >= 2)
  +                log("  loading attribute '" + name +
  +                    "' with value '" + value + "'");
               setAttribute(name, value);
   	}
           isValid = isValidSave;
  @@ -1085,6 +1099,8 @@
   	stream.writeObject(new Boolean(isValid));
   	stream.writeObject(new Long(thisAccessedTime));
   	stream.writeObject(id);
  +        if (debug >= 2)
  +            log("writeObject() storing session " + id);
   
   	// Accumulate the names of serializable and non-serializable attributes
   	String keys[] = keys();
  @@ -1112,10 +1128,16 @@
   	    stream.writeObject((String) saveNames.get(i));
   	    try {
   		stream.writeObject(saveValues.get(i));
  +                if (debug >= 2)
  +                    log("  storing attribute '" + saveNames.get(i) +
  +                        "' with value '" + saveValues.get(i) + "'");
   	    } catch (NotSerializableException e) {
   		log(sm.getString("standardSession.notSerializable",
   				 saveNames.get(i), id));
   		stream.writeObject(NOT_SERIALIZED);
  +                if (debug >= 2)
  +                    log("  storing attribute '" + saveNames.get(i) +
  +                        "' with value NOT_SERIALIZED");
   		unbinds.add(saveNames.get(i));
   	    }
   	}