[infinispan-commits] Infinispan SVN: r250 - trunk/core/src/main/java/org/infinispan/commands.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Mon May 11 13:26:48 EDT 2009


Author: manik.surtani at jboss.com
Date: 2009-05-11 13:26:48 -0400 (Mon, 11 May 2009)
New Revision: 250

Modified:
   trunk/core/src/main/java/org/infinispan/commands/CommandsFactoryImpl.java
Log:
Cache 'cacheName'

Modified: trunk/core/src/main/java/org/infinispan/commands/CommandsFactoryImpl.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/commands/CommandsFactoryImpl.java	2009-05-11 17:25:56 UTC (rev 249)
+++ trunk/core/src/main/java/org/infinispan/commands/CommandsFactoryImpl.java	2009-05-11 17:26:48 UTC (rev 250)
@@ -42,6 +42,7 @@
 import org.infinispan.container.DataContainer;
 import org.infinispan.distribution.DistributionManager;
 import org.infinispan.factories.annotations.Inject;
+import org.infinispan.factories.annotations.Start;
 import org.infinispan.interceptors.InterceptorChain;
 import org.infinispan.loaders.CacheLoaderManager;
 import org.infinispan.notifications.cachelistener.CacheNotifier;
@@ -61,6 +62,7 @@
    private CacheNotifier notifier;
    private Cache cache;
    private CacheLoaderManager cacheLoaderManager;
+   private String cacheName;
 
    // some stateless commands can be reused so that they aren't constructed again all the time.
    SizeCommand cachedSizeCommand;
@@ -79,6 +81,12 @@
       this.distributionManager = distributionManager;
    }
 
+   @Start(priority = 1)
+   // needs to happen early on
+   public void start() {
+      cacheName = cache.getName();
+   }
+
    public PutKeyValueCommand buildPutKeyValueCommand(Object key, Object value, long lifespanMillis, long maxIdleTimeMillis) {
       return new PutKeyValueCommand(key, value, false, notifier, lifespanMillis, maxIdleTimeMillis);
    }
@@ -136,11 +144,11 @@
    }
 
    public MultipleRpcCommand buildReplicateCommand(List<ReplicableCommand> toReplicate) {
-      return new MultipleRpcCommand(toReplicate, cache.getName());
+      return new MultipleRpcCommand(toReplicate, cacheName);
    }
 
    public SingleRpcCommand buildSingleRpcCommand(ReplicableCommand call) {
-      return new SingleRpcCommand(cache.getName(), call);
+      return new SingleRpcCommand(cacheName, call);
    }
 
    public StateTransferControlCommand buildStateTransferControlCommand(boolean block) {
@@ -148,7 +156,7 @@
    }
 
    public ClusteredGetCommand buildClusteredGetCommand(Object key) {
-      return new ClusteredGetCommand(key, cache.getName());
+      return new ClusteredGetCommand(key, cacheName);
    }
 
    public void initializeReplicableCommand(ReplicableCommand c) {
@@ -203,6 +211,6 @@
    }
 
    public LockControlCommand buildLockControlCommand(Collection keys, boolean lock) {
-      return new LockControlCommand(keys,lock);
+      return new LockControlCommand(keys, lock);
    }
 }




More information about the infinispan-commits mailing list