[jboss-cvs] JBossAS SVN: r80757 - projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Nov 10 17:18:56 EST 2008


Author: bstansberry at jboss.com
Date: 2008-11-10 17:18:55 -0500 (Mon, 10 Nov 2008)
New Revision: 80757

Modified:
   projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/AbstractJBossCacheService.java
   projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/FieldBasedJBossCacheService.java
Log:
[JBAS-6186] Cleaner way of handling per-session regions

Modified: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/AbstractJBossCacheService.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/AbstractJBossCacheService.java	2008-11-10 22:13:23 UTC (rev 80756)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/AbstractJBossCacheService.java	2008-11-10 22:18:55 UTC (rev 80757)
@@ -418,21 +418,25 @@
    }
 
    /**
-    * If the session requires a region in the cache, establishes one.
+    * Extension point to allow subclasses to add per-session JBC regions.
     * 
     * @param session the session
     * @param fqn the fqn for the session
     */
    protected void setupSessionRegion(DistributableSession session, Fqn fqn)
-   {
-      plainCache_.getRegion(fqn, true);
-      session.createdRegionForSession();
-      if (log_.isTraceEnabled())
-      {
-         log_.trace("Created region for session at " + fqn);
-      }
+   {      
    }
 
+   /**
+    * Extension point to allow subclasses to remove per-session JBC regions.
+    * 
+    * @param session the session
+    * @param fqn the fqn for the session
+    */
+   protected void removeSessionRegion(String realId, Fqn fqn)
+   {      
+   }
+
    public void removeSession(String realId)
    {
       Fqn fqn = getSessionFqn(combinedPath_, realId);
@@ -442,6 +446,8 @@
       }
 
       cacheWrapper_.remove(fqn);
+      
+      removeSessionRegion(realId, fqn);
    }
 
    public void removeSessionLocal(String realId)
@@ -453,6 +459,8 @@
       }
       
       cacheWrapper_.removeLocal(fqn);
+      
+      removeSessionRegion(realId, fqn);
    }
 
    public void removeSessionLocal(String realId, String dataOwner)

Modified: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/FieldBasedJBossCacheService.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/FieldBasedJBossCacheService.java	2008-11-10 22:13:23 UTC (rev 80756)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/FieldBasedJBossCacheService.java	2008-11-10 22:18:55 UTC (rev 80757)
@@ -36,6 +36,7 @@
 import org.jboss.ha.framework.server.PojoCacheManager;
 import org.jboss.ha.framework.server.PojoCacheManagerLocator;
 import org.jboss.web.tomcat.service.session.distributedcache.spi.ClusteringNotSupportedException;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributableSession;
 import org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager;
 
 /**
@@ -103,24 +104,6 @@
       }
    }
 
-   @Override
-   public void removeSession(String realId)
-   {
-      super.removeSession(realId);
-      
-      Fqn fqn = getSessionFqn(combinedPath_, realId);
-      getCache().removeRegion(fqn);
-   }
-
-   @Override
-   public void removeSessionLocal(String realId)
-   {
-      super.removeSessionLocal(realId);
-      
-      Fqn fqn = getSessionFqn(combinedPath_, realId);
-      getCache().removeRegion(fqn);
-   }
-
    public boolean getSupportsAttributeOperations()
    {
       return true;
@@ -222,6 +205,27 @@
    }
    
    @Override
+   protected void setupSessionRegion(DistributableSession session, Fqn fqn)
+   {
+      getCache().getRegion(fqn, true);
+      session.createdRegionForSession();
+      if (log_.isTraceEnabled())
+      {
+         log_.trace("Created region for session at " + fqn);
+      }
+   }
+   
+   @Override
+   protected void removeSessionRegion(String realId, Fqn fqn)
+   {
+      getCache().removeRegion(fqn);
+      if (log_.isTraceEnabled())
+      {
+         log_.trace("Removed region for session at " + fqn);
+      }
+   }
+
+   @Override
    protected void releaseCacheToManager(String cacheConfigName)
    {      
       try




More information about the jboss-cvs-commits mailing list