[jboss-cvs] JBossAS SVN: r108045 - projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/framework/server/ispn.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Sep 8 11:59:08 EDT 2010


Author: pferraro
Date: 2010-09-08 11:59:08 -0400 (Wed, 08 Sep 2010)
New Revision: 108045

Modified:
   projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/framework/server/ispn/DistributedState.java
Log:
Utilize CacheContainerSource for the cache container.
Default cache name to "DistributedState" to avoid inadvertently sharing the default cache.

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-08 15:58:16 UTC (rev 108044)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/framework/server/ispn/DistributedState.java	2010-09-08 15:59:08 UTC (rev 108045)
@@ -34,21 +34,20 @@
 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;
 import org.infinispan.notifications.cachelistener.annotation.CacheEntryRemoved;
 import org.infinispan.notifications.cachelistener.event.CacheEntryModifiedEvent;
 import org.infinispan.notifications.cachelistener.event.CacheEntryRemovedEvent;
-import org.infinispan.CacheException;
-import org.infinispan.notifications.Listener;
 import org.infinispan.remoting.transport.jgroups.JGroupsTransport;
 import org.infinispan.util.SimpleImmutableEntry;
 import org.jboss.ha.core.framework.server.ChannelSource;
 import org.jboss.ha.framework.server.spi.ManagedDistributedState;
-import org.jboss.ha.ispn.CacheContainerRegistry;
 import org.jgroups.Channel;
 
 /**
@@ -74,16 +73,15 @@
 public class DistributedState implements ManagedDistributedState, ChannelSource
 {
    private final ConcurrentMap<String, List<DSListener>> keyListeners = new ConcurrentHashMap<String, List<DSListener>>();
-   private final CacheContainerRegistry registry;
+   private final CacheContainerSource cacheHandler;
    private final AtomicBoolean startedCache = new AtomicBoolean(false);
    
-   private volatile String containerName;
-   private volatile String cacheName;
+   private volatile String cacheName = "DistributedState";
    private volatile Cache<Serializable, Serializable> cache;
 
-   public DistributedState(CacheContainerRegistry registry)
+   public DistributedState(CacheContainerSource cacheHandler)
    {
-      this.registry = registry;
+      this.cacheHandler = cacheHandler;
    }
 
    // Public --------------------------------------------------------
@@ -96,7 +94,7 @@
    @Override
    public void startService() throws Exception
    {
-      CacheContainer container = this.registry.getCacheContainer(this.containerName);
+      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)
@@ -124,11 +122,6 @@
    public void destroyService() throws Exception
    {
    }
-
-   public void setCacheContainerName(String containerName)
-   {
-      this.containerName = containerName;
-   }
    
    public void setCacheName(String cacheName)
    {



More information about the jboss-cvs-commits mailing list