[Jboss-cvs] JBossAS SVN: r56042 - trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/session

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Aug 17 18:41:01 EDT 2006


Author: bstansberry at jboss.com
Date: 2006-08-17 18:41:01 -0400 (Thu, 17 Aug 2006)
New Revision: 56042

Modified:
   trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/session/ClusteredSession.java
Log:
[JBAS-3528] Correctly track if session is new

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/session/ClusteredSession.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/session/ClusteredSession.java	2006-08-17 22:11:31 UTC (rev 56041)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/session/ClusteredSession.java	2006-08-17 22:41:01 UTC (rev 56042)
@@ -150,11 +150,31 @@
     */
    protected transient long lastReplicated;
 
+   /**
+    * Maximum percentage of the inactive interval this session
+    * should be allowed to go unreplicated if access to the
+    * session doesn't mark it as dirty. Drives the calculation
+    * of maxUnreplicatedInterval.
+    */
    protected transient int maxUnreplicatedFactor = 80;
    
+   /**
+    * Maximum number of milliseconds this session
+    * should be allowed to go unreplicated if access to the
+    * session doesn't mark it as dirty. 
+    */
    protected transient long maxUnreplicatedInterval;
    
+   /**
+    * Whether any of this session's attributes implement
+    * HttpSessionActivationListener.
+    */
    protected transient Boolean hasActivationListener;
+   
+   /**
+    * Has this session only been accessed once?
+    */
+   protected transient boolean firstAccess;
 
    /**
     * The string manager for this package.
@@ -449,11 +469,33 @@
    {
       super.access();
 
+      // JBAS-3528. If it's not the first access, make sure
+      // the 'new' flag is correct
+      if (!firstAccess && isNew)
+      {
+         setNew(false);
+      }
+
       if (invalidationPolicy == WebMetaData.SESSION_INVALIDATE_ACCESS)
       {
          this.sessionMetadataDirty();
       }
    }
+   
+   
+   public void endAccess()
+   {
+      super.endAccess();
+      
+      if (firstAccess)
+      {
+         firstAccess = false;
+         // Tomcat marks the session as non new, but that's not really
+         // accurate per SRV.7.2, as the second request hasn't come in yet
+         // So, we fix that
+         isNew = false;
+      }
+   }
 
    public Object getAttribute(String name)
    {
@@ -1082,6 +1124,10 @@
          // We no longer know if we have an activationListener
          hasActivationListener = null;
          
+         // If the session has been replicated, any subsequent
+         // access cannot be the first.
+         this.firstAccess = false;
+         
          // TODO uncomment when work on JBAS-1900 is completed      
 //         // Session notes -- for FORM auth apps, allow replicated session 
 //         // to be used without requiring a new login




More information about the jboss-cvs-commits mailing list