[jboss-cvs] JBossAS SVN: r57366 - branches/Branch_4_0/tomcat/src/main/org/jboss/web/tomcat/tc5/session

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Oct 2 14:39:54 EDT 2006


Author: bstansberry at jboss.com
Date: 2006-10-02 14:39:53 -0400 (Mon, 02 Oct 2006)
New Revision: 57366

Modified:
   branches/Branch_4_0/tomcat/src/main/org/jboss/web/tomcat/tc5/session/CacheListener.java
Log:
Reduce logging level and mark outdated if same version # is replicated

Modified: branches/Branch_4_0/tomcat/src/main/org/jboss/web/tomcat/tc5/session/CacheListener.java
===================================================================
--- branches/Branch_4_0/tomcat/src/main/org/jboss/web/tomcat/tc5/session/CacheListener.java	2006-10-02 18:17:47 UTC (rev 57365)
+++ branches/Branch_4_0/tomcat/src/main/org/jboss/web/tomcat/tc5/session/CacheListener.java	2006-10-02 18:39:53 UTC (rev 57366)
@@ -51,6 +51,9 @@
    // The size of the root of a buddy backup subtree (including owner)
    private static final int BUDDY_BACKUP_ROOT_OWNER_SIZE = BUDDY_BACKUP_ROOT_OWNER_INDEX + 1;
    
+//   private static final String TREE_CACHE_CLASS = "org.jboss.cache.TreeCache";
+//   private static final String DATA_GRAVITATION_CLEANUP = "_dataGravitationCleanup";
+   
    private static Logger log_ = Logger.getLogger(CacheListener.class);
    private JBossCacheWrapper cacheWrapper_;
    private JBossCacheManager manager_;
@@ -92,7 +95,9 @@
          manager_.processRemoteAttributeRemoval(sessId, attrKey);
       }
       else if(isFqnSessionRootSized(fqn, isBuddy) 
-                  && isFqnForOurWebapp(fqn, isBuddy))
+                  && isFqnForOurWebapp(fqn, isBuddy)
+//                  && !isDataGravitationCleanup()
+                  )
       {
          // A session has been invalidated from another node;
          // need to inform manager
@@ -152,18 +157,32 @@
                           version.intValue());
             }
          }
-         else if (!isBuddy)
+         else if (isBuddy)
          {
-            log_.warn("Possible concurrency problem: Replicated version id " + 
-                      version + " matches in-memory version for session " + realId); 
+            // We have a local session but got a modification for the buddy tree.
+            // This means another node is in the process of taking over the session;
+            // we don't worry about it
+            ;
          }
-         /*else 
+         else 
          {
-            We have a local session but got a modification for the buddy tree.
-            This means another node is in the process of taking over the session;
-            we don't worry about it
+            // This could be an issue but can happen legitimately in unusual 
+            // circumstances, so just log something at INFO, not WARN
+            
+            // Unusual circumstance: create session; don't touch session again
+            // until timeout period expired; fail over to another node after
+            // timeout but before session expiration thread has run. Existing
+            // session will be expired locally on new node and a new session created.
+            // When that session replicates, the version id will match the still
+            // existing cached session on the first node.  Unlikely, but due
+            // to design of a unit test, it happens every testsuite run :-)
+            log_.info("Possible concurrency problem: Replicated version id " + 
+                       version + " matches in-memory version for session " + realId);
+            
+            // Mark the loaded session outdated anyway; in the above mentioned
+            // "unusual circumstance" that's the correct thing to do
+            session.setOutdatedVersion(version.intValue());
          }
-          */
       }
       else
       {
@@ -232,4 +251,23 @@
    {
       return (String) fqn.get(BUDDY_BACKUP_ROOT_OWNER_INDEX);     
    }
+   
+//   /**
+//    * FIXME This is a hack that examines the stack trace looking
+//    * for the TreeCache._dataGravitationCleanup method.
+//    * 
+//    * @return
+//    */
+//   private static boolean isDataGravitationCleanup()
+//   {
+//      StackTraceElement[] trace = new Throwable().getStackTrace();
+//      for (int i = 0; i < trace.length; i++)
+//      {
+//         if (TREE_CACHE_CLASS.equals(trace[i].getClassName())
+//               && DATA_GRAVITATION_CLEANUP.equals(trace[i].getMethodName()))
+//            return true;
+//      }
+//      
+//      return false;
+//   }
 }




More information about the jboss-cvs-commits mailing list