[Jboss-cvs] JBossAS SVN: r56326 - 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 Aug 28 01:36:51 EDT 2006


Author: bstansberry at jboss.com
Date: 2006-08-28 01:36:50 -0400 (Mon, 28 Aug 2006)
New Revision: 56326

Modified:
   branches/Branch_4_0/tomcat/src/main/org/jboss/web/tomcat/tc5/session/CacheListener.java
Log:
Further listener optimization

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-08-28 05:35:58 UTC (rev 56325)
+++ branches/Branch_4_0/tomcat/src/main/org/jboss/web/tomcat/tc5/session/CacheListener.java	2006-08-28 05:36:50 UTC (rev 56326)
@@ -48,6 +48,8 @@
    private static final int BUDDY_BACKUP_ROOT_OWNER_SIZE = BUDDY_BACKUP_ROOT_OWNER_INDEX + 1;
    // Size of an Fqn that points to the root of a session in the buddy backup region
    private static final int BUDDY_SESSION_FQN_SIZE = BUDDY_BACKUP_ROOT_OWNER_SIZE + SESSION_FQN_SIZE;
+   // Size of an Fqn that points to the root of a session in the buddy backup region
+   private static final int BUDDY_POJO_KEY_FQN_SIZE = BUDDY_BACKUP_ROOT_OWNER_SIZE + POJO_KEY_FQN_SIZE;
    
    protected static Logger log_ = Logger.getLogger(CacheListener.class);
    protected JBossCacheWrapper cacheWrapper_;
@@ -72,14 +74,25 @@
 
    public void nodeRemoved(Fqn fqn)
    {
+      // We only care if there is a chance this is for a session root
+      // or a pojo key
+      int rawSize = fqn.size();      
+      if (rawSize != SESSION_FQN_SIZE 
+            && rawSize != BUDDY_SESSION_FQN_SIZE
+            && rawSize != POJO_KEY_FQN_SIZE
+            && rawSize != BUDDY_POJO_KEY_FQN_SIZE)
+         return;
+      
+      // Ignore our own activity
       if (SessionReplicationContext.isLocallyActive())
          return;
       
+      // Parse the Fqn so if it has a buddy backup region in it
+      // we can just deal with the part below that
       ParsedBuddyFqn pfqn = new ParsedBuddyFqn(fqn);
       fqn = pfqn.noBuddy;
       
-      // Potential removal of a Pojo where we need to unregister
-      // as an Observer.
+      // Potential removal of a Pojo where we need to unregister as an Observer.
       if (fieldBased_ 
             && fqn.size() == POJO_KEY_FQN_SIZE
             && fqn.isChildOf(subtreeRoot_))
@@ -112,23 +125,22 @@
 
    protected void nodeDirty(Fqn fqn)
    {
+      // We only care if there is a chance this is for a session root
+      int rawSize = fqn.size();      
+      if (rawSize != SESSION_FQN_SIZE && rawSize != BUDDY_SESSION_FQN_SIZE)
+         return;
+      
       // Ignore local activity
       if (SessionReplicationContext.isLocallyActive())
          return;
       
-      // We only care if there is a chance this is for a session root
-      if (fqn.size() != SESSION_FQN_SIZE && fqn.size() != BUDDY_SESSION_FQN_SIZE)
-         return;
-      
       // Parse the Fqn so if it has a buddy backup region in it
       // we can just deal with the part below that
       ParsedBuddyFqn pfqn = new ParsedBuddyFqn(fqn);
       Fqn noBuddy = pfqn.noBuddy;
       
-      // Check if we need to handle this event. If this is from myself or not for
-      // my webapp, then I should skip it.
-      // We only deal with events for the root node of a session,
-      // so skip all others
+      // Check if we need to handle this event. If this is not for my webapp, 
+      // or not for the root node of a session then I should skip it.
       if(noBuddy.size() != SESSION_FQN_SIZE || !noBuddy.isChildOf(subtreeRoot_)) 
          return;
 




More information about the jboss-cvs-commits mailing list