[jboss-cvs] JBossAS SVN: r108179 - in projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss: ha/jndi/ispn and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Sep 16 13:17:13 EDT 2010


Author: pferraro
Date: 2010-09-16 13:17:12 -0400 (Thu, 16 Sep 2010)
New Revision: 108179

Modified:
   projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/framework/server/ispn/DistributedState.java
   projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/jndi/ispn/DistributedTreeManager.java
   projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/sso/ispn/SSOClusterManager.java
Log:
Always stop cache - we're not sharing them.

Modified: projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/framework/server/ispn/DistributedState.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/framework/server/ispn/DistributedState.java	2010-09-16 17:10:53 UTC (rev 108178)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/framework/server/ispn/DistributedState.java	2010-09-16 17:17:12 UTC (rev 108179)
@@ -31,13 +31,11 @@
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.infinispan.Cache;
 import org.infinispan.CacheException;
 import org.infinispan.atomic.AtomicMap;
 import org.infinispan.atomic.AtomicMapLookup;
-import org.infinispan.lifecycle.ComponentStatus;
 import org.infinispan.manager.CacheContainer;
 import org.infinispan.notifications.Listener;
 import org.infinispan.notifications.cachelistener.annotation.CacheEntryModified;
@@ -75,7 +73,6 @@
 {
    private final ConcurrentMap<String, List<DSListener>> keyListeners = new ConcurrentHashMap<String, List<DSListener>>();
    private final CacheContainerSource cacheHandler;
-   private final AtomicBoolean startedCache = new AtomicBoolean(false);
    
    private volatile String cacheName = "DistributedState";
    private volatile Cache<Serializable, Serializable> cache;
@@ -99,10 +96,9 @@
       CacheContainer container = this.cacheHandler.getCacheContainer();
       this.cache = (this.cacheName != null) ? container.<Serializable, Serializable>getCache(this.cacheName) : container.<Serializable, Serializable>getCache();
       
-      if (this.cache.getStatus() != ComponentStatus.RUNNING)
+      if (!this.cache.getStatus().allowInvocations())
       {
          this.cache.start();
-         this.startedCache.set(true);
       }
       
       this.cache.addListener(this);
@@ -113,11 +109,7 @@
    {      
       this.cache.removeListener(this);
       
-      // Only stop cache if we started it
-      if (this.startedCache.compareAndSet(true, false))
-      {
-         this.cache.stop();
-      }
+      this.cache.stop();
    }
 
    @Override

Modified: projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/jndi/ispn/DistributedTreeManager.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/jndi/ispn/DistributedTreeManager.java	2010-09-16 17:10:53 UTC (rev 108178)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/jndi/ispn/DistributedTreeManager.java	2010-09-16 17:17:12 UTC (rev 108179)
@@ -28,7 +28,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.naming.Binding;
 import javax.naming.Context;
@@ -43,7 +42,6 @@
 
 import org.infinispan.Cache;
 import org.infinispan.CacheException;
-import org.infinispan.lifecycle.ComponentStatus;
 import org.infinispan.manager.CacheContainer;
 import org.infinispan.tree.Fqn;
 import org.infinispan.tree.Node;
@@ -74,7 +72,6 @@
 
    private final CacheContainerRegistry registry;
    private final TreeCacheFactory treeCacheFactory;
-   private final AtomicBoolean startedCache = new AtomicBoolean(false);
    
    private volatile String containerName;
    private volatile String cacheName = "DistributedTreeManager";
@@ -99,10 +96,9 @@
       Cache<String, Binding> cache = (this.cacheName == null) ? container.<String, Binding>getCache() : container.<String, Binding>getCache(this.cacheName);
       this.cache = this.treeCacheFactory.createTreeCache(cache);
       
-      if (cache.getStatus() != ComponentStatus.RUNNING)
+      if (!cache.getStatus().allowInvocations())
       {
          this.cache.start();
-         this.startedCache.set(true);
       }
    }
 
@@ -110,10 +106,7 @@
    @Override
    public void shutdown()
    {
-      if (this.startedCache.compareAndSet(true, false))
-      {
-         this.cache.stop();
-      }
+      this.cache.stop();
    }
 
    public void setCacheContainerName(String containerName)

Modified: projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/sso/ispn/SSOClusterManager.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/sso/ispn/SSOClusterManager.java	2010-09-16 17:10:53 UTC (rev 108178)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/sso/ispn/SSOClusterManager.java	2010-09-16 17:17:12 UTC (rev 108179)
@@ -25,7 +25,6 @@
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
@@ -35,7 +34,6 @@
 import org.infinispan.Cache;
 import org.infinispan.atomic.AtomicMap;
 import org.infinispan.config.Configuration;
-import org.infinispan.lifecycle.ComponentStatus;
 import org.infinispan.manager.CacheContainer;
 import org.infinispan.notifications.Listener;
 import org.infinispan.notifications.cachelistener.annotation.CacheEntryModified;
@@ -97,7 +95,6 @@
     * The CacheKey will indicate which type it is (CacheKey.CREDENTIAL or CacheKey.SESSION);
     */
    private volatile Cache<SSOKey, ?> cache = null;
-   private final AtomicBoolean startedCache = new AtomicBoolean(false);
    
    /**
     * Transaction Manager
@@ -744,10 +741,9 @@
       CacheContainer container = this.registry.getCacheContainer(containerName);
       this.cache = (cacheName == null) ? container.<SSOKey, Object>getCache() : container.<SSOKey, Object>getCache(cacheName);
       
-      if (this.cache.getStatus() != ComponentStatus.RUNNING)
+      if (!this.cache.getStatus().allowInvocations())
       {
          this.cache.start();
-         this.startedCache.set(true);
       }
       
       initThreadPool();
@@ -780,11 +776,7 @@
 
       this.cache.removeListener(this);
       
-      // Only stop the cache if we started it
-      if (this.startedCache.compareAndSet(true, false))
-      {
-         this.cache.stop();
-      }
+      this.cache.stop();
 
       started = false;
    }



More information about the jboss-cvs-commits mailing list