[jboss-cvs] JBossAS SVN: r95349 - 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
Wed Oct 21 17:50:00 EDT 2009


Author: bstansberry at jboss.com
Date: 2009-10-21 17:49:59 -0400 (Wed, 21 Oct 2009)
New Revision: 95349

Modified:
   projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/AbstractJBossCacheService.java
Log:
[JBCLUSTER-242] Use CacheLoader config's purgeOnStartup to control whether cache is cleared at start/stop

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	2009-10-21 21:43:36 UTC (rev 95348)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/AbstractJBossCacheService.java	2009-10-21 21:49:59 UTC (rev 95349)
@@ -45,6 +45,7 @@
 import org.jboss.cache.buddyreplication.BuddyManager;
 import org.jboss.cache.config.BuddyReplicationConfig;
 import org.jboss.cache.config.CacheLoaderConfig;
+import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
 import org.jboss.cache.pojo.impl.InternalConstant;
 import org.jboss.cache.transaction.BatchModeTransactionManager;
 import org.jboss.ha.framework.interfaces.CachableMarshalledValue;
@@ -131,6 +132,8 @@
    
    protected String cacheConfigName_;
    
+   private boolean purgeOnStartStop_ = true;
+   
    protected AbstractJBossCacheService(LocalDistributableSessionManager localManager) throws ClusteringNotSupportedException
    {
       this(localManager, Util.findPlainCache(Util.getCacheConfigName(localManager)));
@@ -146,11 +149,23 @@
       this.cacheWrapper_ = new JBossCacheWrapper(plainCache_);
       
       this.useTreeCacheMarshalling_ = plainCache_.getConfiguration().isUseRegionBasedMarshalling();
+      boolean purge = true;
       CacheLoaderConfig clc = plainCache_.getConfiguration().getCacheLoaderConfig();
       if(clc != null)
       {
          usePassivation_ = (clc.isPassivation() && !clc.isShared());
+         purge = false;
+         for (IndividualCacheLoaderConfig iclc : clc.getIndividualCacheLoaderConfigs())
+         {
+            if (iclc.isPurgeOnStartup())
+            {
+               purge = true;
+               break;
+            }
+         }
       }
+      
+      this.purgeOnStartStop_ = purge && (this.useBuddyReplication_ || this.useTreeCacheMarshalling_);
    }
    
    protected LocalDistributableSessionManager getManager()
@@ -216,9 +231,8 @@
       
       Fqn<String> pathFqn = Fqn.fromElements(SESSION, combinedPath_);
       
-      BuddyReplicationConfig brc = plainCache_.getConfiguration().getBuddyReplicationConfig();
-      this.useBuddyReplication_ = brc != null && brc.isEnabled();
-      if (useTreeCacheMarshalling_ || this.useBuddyReplication_)
+//      if (useTreeCacheMarshalling_ || this.useBuddyReplication_)
+      if (this.purgeOnStartStop_)
       {
          // JBAS-5628/JBAS-5629 -- clean out persistent store
          cleanWebappRegion(pathFqn);
@@ -294,9 +308,9 @@
                        " or un-registration of its class loader", e);
          }
       } 
-      BuddyReplicationConfig brc = plainCache_.getConfiguration().getBuddyReplicationConfig();
-      this.useBuddyReplication_ = brc != null && brc.isEnabled();
-      if (useTreeCacheMarshalling_ || this.useBuddyReplication_)
+      
+//      if (useTreeCacheMarshalling_ || this.useBuddyReplication_)
+      if (this.purgeOnStartStop_)
       {
          // JBAS-5628/JBAS-5629 -- clean out persistent store
          cleanWebappRegion(pathFqn);




More information about the jboss-cvs-commits mailing list