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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Aug 24 01:18:28 EDT 2010


Author: pferraro
Date: 2010-08-24 01:18:27 -0400 (Tue, 24 Aug 2010)
New Revision: 107751

Added:
   projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/CacheSource.java
   projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DefaultCacheSource.java
   projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DefaultCacheSourceTest.java
Modified:
   projects/cluster/ha-server-cache-ispn/trunk/pom.xml
   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/session/distributedcache/ispn/DistributedCacheManager.java
   projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DistributedCacheManagerFactory.java
   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/test/java/org/jboss/ha/framework/server/ispn/HAPartitionCacheHandlerTest.java
   projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DistributedCacheManagerFactoryTest.java
   projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DistributedCacheManagerTest.java
Log:
Decouple cache source logic from DCM.

Modified: projects/cluster/ha-server-cache-ispn/trunk/pom.xml
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/pom.xml	2010-08-24 04:32:08 UTC (rev 107750)
+++ projects/cluster/ha-server-cache-ispn/trunk/pom.xml	2010-08-24 05:18:27 UTC (rev 107751)
@@ -32,7 +32,7 @@
   <properties>
     <version.jboss.ha.server.cache.spi>3.0.0.Alpha4</version.jboss.ha.server.cache.spi>
     <version.jboss.ha.server.core>1.0.0.Alpha5</version.jboss.ha.server.core>
-    <version.jboss.ha.server.ispn>1.0.0.Alpha6</version.jboss.ha.server.ispn>
+    <version.jboss.ha.server.ispn>1.0.0.Alpha7</version.jboss.ha.server.ispn>
     <version.junit>4.8.1</version.junit>
     <version.easymock>3.0</version.easymock>
   </properties>

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-08-24 04:32:08 UTC (rev 107750)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/framework/server/ispn/DistributedState.java	2010-08-24 05:18:27 UTC (rev 107751)
@@ -31,6 +31,7 @@
 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.atomic.AtomicMap;
@@ -73,8 +74,8 @@
 {
    private final ConcurrentMap<String, List<DSListener>> keyListeners = new ConcurrentHashMap<String, List<DSListener>>();
    private final CacheContainerRegistry registry;
-
-   private volatile boolean stopCache = false;
+   private final AtomicBoolean startedCache = new AtomicBoolean(false);
+   
    private volatile String containerName;
    private volatile String cacheName;
    private volatile Cache<Serializable, Serializable> cache;
@@ -99,7 +100,7 @@
       if (this.cache.getStatus() != ComponentStatus.RUNNING)
       {
          this.cache.start();
-         this.stopCache = true;
+         this.startedCache.set(true);
       }
       
       this.cache.addListener(this);
@@ -110,10 +111,9 @@
    {      
       this.cache.removeListener(this);
       
-      if (this.stopCache)
+      if (this.startedCache.compareAndSet(true, false))
       {
          this.cache.stop();
-         this.stopCache = false;
       }
    }
 

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-08-24 04:32:08 UTC (rev 107750)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/jndi/ispn/DistributedTreeManager.java	2010-08-24 05:18:27 UTC (rev 107751)
@@ -28,6 +28,7 @@
 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;
@@ -73,8 +74,8 @@
 
    private final CacheContainerRegistry registry;
    private final TreeCacheFactory treeCacheFactory;
+   private final AtomicBoolean startedCache = new AtomicBoolean(false);
    
-   private volatile boolean stopCache = false;
    private volatile String containerName;
    private volatile String cacheName;
    private volatile Naming haStub;
@@ -100,7 +101,7 @@
       if (cache.getStatus() != ComponentStatus.RUNNING)
       {
          this.cache.start();
-         this.stopCache = true;
+         this.startedCache.set(true);
       }
       
       LOG.debug("initializing HAJNDITreeCache root");
@@ -110,10 +111,9 @@
    @Override
    public void shutdown()
    {
-      if (this.stopCache)
+      if (this.startedCache.compareAndSet(true, false))
       {
          this.cache.stop();
-         this.stopCache = false;
       }
    }
 

Added: projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/CacheSource.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/CacheSource.java	                        (rev 0)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/CacheSource.java	2010-08-24 05:18:27 UTC (rev 107751)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.web.tomcat.service.session.distributedcache.ispn;
+
+import org.infinispan.Cache;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager;
+
+/**
+ * @author Paul Ferraro
+ *
+ */
+public interface CacheSource
+{
+   <K, V> Cache<K, V> getCache(LocalDistributableSessionManager manager);
+}

Added: projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DefaultCacheSource.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DefaultCacheSource.java	                        (rev 0)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DefaultCacheSource.java	2010-08-24 05:18:27 UTC (rev 107751)
@@ -0,0 +1,130 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.web.tomcat.service.session.distributedcache.ispn;
+
+import org.infinispan.Cache;
+import org.infinispan.config.Configuration;
+import org.infinispan.config.Configuration.CacheMode;
+import org.infinispan.manager.EmbeddedCacheManager;
+import org.jboss.ha.ispn.CacheContainerRegistry;
+import org.jboss.metadata.web.jboss.ReplicationConfig;
+import org.jboss.metadata.web.jboss.ReplicationMode;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager;
+
+/**
+ * @author Paul Ferraro
+ *
+ */
+public class DefaultCacheSource implements CacheSource
+{
+   private final CacheContainerRegistry registry;
+   
+   public DefaultCacheSource(CacheContainerRegistry registry)
+   {
+      this.registry = registry;
+   }
+
+   @Override
+   public <K, V> Cache<K, V> getCache(LocalDistributableSessionManager manager)
+   {
+      ReplicationConfig replConfig = manager.getReplicationConfig();
+      String templateCacheName = replConfig.getCacheName();
+      
+      String containerName = null;
+      
+      if (templateCacheName != null)
+      {
+         String[] parts = templateCacheName.split(":");
+         
+         if (parts.length == 2)
+         {
+            containerName = parts[0];
+            templateCacheName = parts[1];
+         }
+      }
+      
+      EmbeddedCacheManager container = this.registry.getCacheContainer(containerName);
+      
+      String hostName = manager.getHostName();
+      String host = (hostName == null) || hostName.isEmpty() ? "localhost" : hostName;
+      
+      String context = manager.getContextName();
+      String path = context.isEmpty() || context.equals("/") ? "ROOT" : context.startsWith("/") ? context.substring(1) : context;
+
+      String cacheName = host + "/" + path;
+
+      Cache<?, ?> templateCache = container.getCache();
+      Configuration configuration = templateCache.getConfiguration().clone();
+      
+      Integer backups = replConfig.getBackups();
+      ReplicationMode replMode = replConfig.getReplicationMode();
+      
+      CacheMode mode = configuration.getCacheMode();
+      
+      if (backups != null)
+      {
+         int value = backups.intValue();
+         
+         configuration.setNumOwners(value);
+         
+         if (value == 0)
+         {
+            mode = CacheMode.LOCAL;
+         }
+         else
+         {
+            boolean synchronous = mode.isSynchronous();
+            if (value > 0)
+            {
+               mode = synchronous ? CacheMode.DIST_SYNC : CacheMode.DIST_ASYNC;
+            }
+            else // Negative backups means total replication
+            {
+               mode = synchronous ? CacheMode.REPL_SYNC : CacheMode.REPL_ASYNC;
+            }
+         }
+      }
+      
+      if (replMode != null)
+      {
+         switch (replMode)
+         {
+            case SYNCHRONOUS:
+            {
+               mode = mode.toSync();
+               break;
+            }
+            case ASYNCHRONOUS:
+            {
+               mode = mode.toAsync();
+               break;
+            }
+         }
+      }
+      
+      configuration.setCacheMode(mode);
+      
+      container.defineConfiguration(cacheName, configuration);
+      
+      return container.getCache(cacheName);
+   }
+}

Modified: projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DistributedCacheManager.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DistributedCacheManager.java	2010-08-24 04:32:08 UTC (rev 107750)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DistributedCacheManager.java	2010-08-24 05:18:27 UTC (rev 107751)
@@ -23,19 +23,14 @@
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
 
-import javax.transaction.TransactionManager;
-
 import org.infinispan.Cache;
 import org.infinispan.atomic.AtomicMap;
 import org.infinispan.config.CacheLoaderManagerConfig;
-import org.infinispan.config.Configuration;
-import org.infinispan.config.Configuration.CacheMode;
 import org.infinispan.context.Flag;
 import org.infinispan.distribution.DistributionManager;
 import org.infinispan.lifecycle.ComponentStatus;
-import org.infinispan.manager.CacheContainer;
-import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.notifications.Listener;
 import org.infinispan.notifications.cachelistener.annotation.CacheEntryActivated;
 import org.infinispan.notifications.cachelistener.annotation.CacheEntryModified;
@@ -43,14 +38,9 @@
 import org.infinispan.notifications.cachelistener.event.CacheEntryActivatedEvent;
 import org.infinispan.notifications.cachelistener.event.CacheEntryModifiedEvent;
 import org.infinispan.notifications.cachelistener.event.CacheEntryRemovedEvent;
-import org.infinispan.transaction.tm.BatchModeTransactionManager;
-import org.jboss.ha.ispn.CacheContainerRegistry;
 import org.jboss.ha.ispn.atomic.AtomicMapFactory;
 import org.jboss.ha.ispn.invoker.CacheInvoker;
 import org.jboss.logging.Logger;
-import org.jboss.metadata.web.jboss.ReplicationConfig;
-import org.jboss.metadata.web.jboss.ReplicationMode;
-import org.jboss.web.tomcat.service.session.distributedcache.impl.BatchingManagerImpl;
 import org.jboss.web.tomcat.service.session.distributedcache.impl.IncomingDistributableSessionDataImpl;
 import org.jboss.web.tomcat.service.session.distributedcache.spi.BatchingManager;
 import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributableSessionMetadata;
@@ -88,21 +78,26 @@
    
    private final LocalDistributableSessionManager manager;
    private final SessionAttributeStorage<T> attributeStorage;
+   private final Cache<String, AtomicMap<Object, Object>> cache;
    private final CacheInvoker invoker;
-   private final CacheContainerRegistry registry;
+   private final BatchingManager batchingManager;
+   private final boolean passivationEnabled;
    final AtomicMapFactory atomicMapFactory;
    
-   private Cache<String, AtomicMap<Object, Object>> cache;
-   private BatchingManagerImpl batchingManager;
-   private boolean passivationEnabled = false;
+   private final AtomicBoolean startedCache = new AtomicBoolean(false);
    
-   public DistributedCacheManager(LocalDistributableSessionManager manager, CacheContainerRegistry registry, SessionAttributeStorage<T> attributeStorage, CacheInvoker invoker, AtomicMapFactory atomicMapFactory)
+   public DistributedCacheManager(LocalDistributableSessionManager manager, Cache<String, AtomicMap<Object, Object>> cache, SessionAttributeStorage<T> attributeStorage, BatchingManager batchingManager, CacheInvoker invoker, AtomicMapFactory atomicMapFactory)
    {
       this.manager = manager;
-      this.registry = registry;
+      this.cache = cache;
       this.attributeStorage = attributeStorage;
+      this.batchingManager = batchingManager;
       this.invoker = invoker;
       this.atomicMapFactory = atomicMapFactory;
+      
+      CacheLoaderManagerConfig loaderManagerConfig = this.cache.getConfiguration().getCacheLoaderManagerConfig();
+      
+      this.passivationEnabled = (loaderManagerConfig != null) ? loaderManagerConfig.isPassivation().booleanValue() && !loaderManagerConfig.isShared().booleanValue() : false;
    }
 
    /**
@@ -112,107 +107,13 @@
    @Override
    public void start()
    {
-      ReplicationConfig replConfig = this.manager.getReplicationConfig();
-      String templateCacheName = replConfig.getCacheName();
-      
-      String containerName = null;
-      
-      if (templateCacheName != null)
-      {
-         String[] parts = templateCacheName.split(":");
-         
-         if (parts.length == 2)
-         {
-            containerName = parts[0];
-            templateCacheName = parts[1];
-         }
-      }
-      
-      CacheContainer container = this.registry.getCacheContainer(containerName);
-      
-      String hostName = this.manager.getHostName();
-      String host = (hostName == null) || hostName.isEmpty() ? "localhost" : hostName;
-      
-      String context = this.manager.getContextName();
-      String path = context.isEmpty() || context.equals("/") ? "ROOT" : context.startsWith("/") ? context.substring(1) : context;
-
-      String cacheName = host + "/" + path;
-
-      Cache<?, ?> templateCache = container.getCache();
-      Configuration configuration = templateCache.getConfiguration().clone();
-      
-      Integer backups = replConfig.getBackups();
-      ReplicationMode replMode = replConfig.getReplicationMode();
-      
-      CacheMode mode = configuration.getCacheMode();
-      
-      if (backups != null)
-      {
-         int value = backups.intValue();
-         
-         configuration.setNumOwners(value);
-         
-         if (value == 0)
-         {
-            mode = CacheMode.LOCAL;
-         }
-         else
-         {
-            boolean synchronous = mode.isSynchronous();
-            if (value > 0)
-            {
-               mode = synchronous ? CacheMode.DIST_SYNC : CacheMode.DIST_ASYNC;
-            }
-            else // Negative backups means total replication
-            {
-               mode = synchronous ? CacheMode.REPL_SYNC : CacheMode.REPL_ASYNC;
-            }
-         }
-      }
-      
-      if (replMode != null)
-      {
-         switch (replMode)
-         {
-            case SYNCHRONOUS:
-            {
-               mode = mode.toSync();
-               break;
-            }
-            case ASYNCHRONOUS:
-            {
-               mode = mode.toAsync();
-               break;
-            }
-         }
-      }
-      
-      configuration.setCacheMode(mode);
-      
-      EmbeddedCacheManager manager = (EmbeddedCacheManager) templateCache.getCacheManager();
-      manager.defineConfiguration(cacheName, configuration);
-      
-      this.cache = manager.getCache(cacheName);
-      
       if (this.cache.getStatus() != ComponentStatus.RUNNING)
       {
          this.cache.start();
+         this.startedCache.set(true);
       }
       
-      TransactionManager tm = this.cache.getAdvancedCache().getTransactionManager();
-      
-      if (!(tm instanceof BatchModeTransactionManager))
-      {
-         throw new IllegalStateException("Unexpected transaction manager type: " + ((tm != null) ? tm.getClass().getName() : "null"));
-      }
-      
-      this.batchingManager = new BatchingManagerImpl(tm);
-      
-      this.cache.addListener(this);
-      
-      CacheLoaderManagerConfig loaderManagerConfig = this.cache.getConfiguration().getCacheLoaderManagerConfig();
-      
-      this.passivationEnabled = (loaderManagerConfig != null) ? loaderManagerConfig.isPassivation().booleanValue() && !loaderManagerConfig.isShared().booleanValue() : false;
+      this.cache.addListener(this);      
    }
    
    /**
@@ -224,7 +125,10 @@
    {
       this.cache.removeListener(this);
       
-      this.cache.stop();
+      if (this.startedCache.compareAndSet(true, false))
+      {
+         this.cache.stop();
+      }
    }
 
    /**

Modified: projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DistributedCacheManagerFactory.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DistributedCacheManagerFactory.java	2010-08-24 04:32:08 UTC (rev 107750)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DistributedCacheManagerFactory.java	2010-08-24 05:18:27 UTC (rev 107751)
@@ -21,13 +21,19 @@
  */
 package org.jboss.web.tomcat.service.session.distributedcache.ispn;
 
-import org.jboss.ha.ispn.CacheContainerRegistry;
+import javax.transaction.TransactionManager;
+
+import org.infinispan.Cache;
+import org.infinispan.atomic.AtomicMap;
+import org.infinispan.transaction.tm.BatchModeTransactionManager;
 import org.jboss.ha.ispn.DefaultCacheContainerRegistry;
 import org.jboss.ha.ispn.atomic.AtomicMapFactory;
 import org.jboss.ha.ispn.atomic.DefaultAtomicMapFactory;
 import org.jboss.ha.ispn.invoker.CacheInvoker;
 import org.jboss.ha.ispn.invoker.RetryingCacheInvoker;
+import org.jboss.web.tomcat.service.session.distributedcache.impl.BatchingManagerImpl;
 import org.jboss.web.tomcat.service.session.distributedcache.impl.SessionAttributeMarshallerFactoryImpl;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.BatchingManager;
 import org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager;
 import org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData;
 import org.jboss.web.tomcat.service.session.distributedcache.spi.SessionAttributeMarshaller;
@@ -39,7 +45,7 @@
  */
 public class DistributedCacheManagerFactory implements org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManagerFactory
 {
-   private CacheContainerRegistry registry = DefaultCacheContainerRegistry.getInstance();
+   private CacheSource source = new DefaultCacheSource(DefaultCacheContainerRegistry.getInstance());
    private SessionAttributeStorageFactory storageFactory = new SessionAttributeStorageFactoryImpl();
    private SessionAttributeMarshallerFactory marshallerFactory = new SessionAttributeMarshallerFactoryImpl();
    private CacheInvoker invoker = new RetryingCacheInvoker(10, 100);
@@ -48,15 +54,25 @@
    @Override
    public <T extends OutgoingDistributableSessionData> org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager<T> getDistributedCacheManager(LocalDistributableSessionManager manager)
    {
+      Cache<String, AtomicMap<Object, Object>> cache = this.source.getCache(manager);
+      
+      TransactionManager tm = cache.getAdvancedCache().getTransactionManager();
+      
+      if (!(tm instanceof BatchModeTransactionManager))
+      {
+         throw new IllegalStateException("Unexpected transaction manager type: " + ((tm != null) ? tm.getClass().getName() : "null"));
+      }
+      
+      BatchingManager batchingManager = new BatchingManagerImpl(tm);
       SessionAttributeMarshaller marshaller = this.marshallerFactory.createMarshaller(manager);
       SessionAttributeStorage<T> storage = this.storageFactory.createStorage(manager.getReplicationConfig().getReplicationGranularity(), marshaller);
       
-      return new DistributedCacheManager<T>(manager, this.registry, storage, this.invoker, this.atomicMapFactory);
+      return new DistributedCacheManager<T>(manager, cache, storage, batchingManager, this.invoker, this.atomicMapFactory);
    }
    
-   public void setCacheContainerRegistry(CacheContainerRegistry registry)
+   public void setCacheSource(CacheSource source)
    {
-      this.registry = registry;
+      this.source = source;
    }
    
    public void setSessionAttributeStorageFactory(SessionAttributeStorageFactory storageFactory)

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-08-24 04:32:08 UTC (rev 107750)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/sso/ispn/SSOClusterManager.java	2010-08-24 05:18:27 UTC (rev 107751)
@@ -22,6 +22,17 @@
 
 package org.jboss.web.tomcat.service.sso.ispn;
 
+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;
+import javax.transaction.Status;
+import javax.transaction.TransactionManager;
+
+import org.infinispan.Cache;
 import org.infinispan.atomic.AtomicMap;
 import org.infinispan.config.Configuration;
 import org.infinispan.lifecycle.ComponentStatus;
@@ -32,7 +43,6 @@
 import org.infinispan.notifications.cachelistener.event.CacheEntryRemovedEvent;
 import org.infinispan.notifications.cachemanagerlistener.annotation.ViewChanged;
 import org.infinispan.notifications.cachemanagerlistener.event.ViewChangedEvent;
-import org.infinispan.Cache;
 import org.infinispan.remoting.transport.Address;
 import org.jboss.ha.ispn.CacheContainerRegistry;
 import org.jboss.ha.ispn.DefaultCacheContainerRegistry;
@@ -44,14 +54,6 @@
 import org.jboss.web.tomcat.service.sso.spi.SSOCredentials;
 import org.jboss.web.tomcat.service.sso.spi.SSOLocalManager;
 
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.transaction.Status;
-import javax.transaction.TransactionManager;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
 /**
  * An implementation of SSOClusterManager that uses a Infinispan cache
  * to share SSO information between cluster nodes.
@@ -94,7 +96,7 @@
     * The CacheKey will indicate which type it is (CacheKey.CREDENTIAL or CacheKey.SESSION);
     */
    private volatile Cache<SSOKey, ?> cache = null;
-   private volatile boolean stopCache = false;
+   private final AtomicBoolean startedCache = new AtomicBoolean(false);
    
    /**
     * Transaction Manager
@@ -739,11 +741,11 @@
       CacheContainerRegistry registry = DefaultCacheContainerRegistry.getInstance();
       CacheContainer container = registry.getCacheContainer(containerName);
       this.cache = container.getCache(cacheName);
-
+      
       if (this.cache.getStatus() != ComponentStatus.RUNNING)
       {
          this.cache.start();
-         this.stopCache = true;
+         this.startedCache.set(true);
       }
       
       initThreadPool();
@@ -776,10 +778,9 @@
 
       this.cache.removeListener(this);
       
-      if (this.stopCache)
+      if (this.startedCache.compareAndSet(true, false))
       {
          this.cache.stop();
-         this.stopCache = false;
       }
 
       started = false;

Modified: projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/framework/server/ispn/HAPartitionCacheHandlerTest.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/framework/server/ispn/HAPartitionCacheHandlerTest.java	2010-08-24 04:32:08 UTC (rev 107750)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/framework/server/ispn/HAPartitionCacheHandlerTest.java	2010-08-24 05:18:27 UTC (rev 107751)
@@ -13,10 +13,7 @@
 import org.infinispan.Cache;
 import org.infinispan.config.GlobalConfiguration;
 import org.infinispan.lifecycle.ComponentStatus;
-import org.infinispan.manager.CacheContainer;
 import org.infinispan.manager.EmbeddedCacheManager;
-import org.jboss.ha.framework.server.ispn.HAPartitionCacheHandler;
-import org.jboss.ha.framework.server.ispn.InfinispanHAPartitionCacheHandler;
 import org.jboss.ha.ispn.CacheContainerRegistry;
 import org.jgroups.ChannelFactory;
 import org.junit.Assert;
@@ -29,7 +26,7 @@
    public void defaults() throws Exception
    {
       CacheContainerRegistry registry = EasyMock.createStrictMock(CacheContainerRegistry.class);
-      CacheContainer container = EasyMock.createStrictMock(CacheContainer.class);
+      EmbeddedCacheManager container = EasyMock.createStrictMock(EmbeddedCacheManager.class);
       @SuppressWarnings("unchecked")
       Cache<Object, Object> cache = EasyMock.createStrictMock(Cache.class);
       
@@ -123,7 +120,7 @@
    public void custom() throws Exception
    {
       CacheContainerRegistry registry = EasyMock.createStrictMock(CacheContainerRegistry.class);
-      CacheContainer container = EasyMock.createStrictMock(CacheContainer.class);
+      EmbeddedCacheManager container = EasyMock.createStrictMock(EmbeddedCacheManager.class);
       @SuppressWarnings("unchecked")
       Cache<Object, Object> cache = EasyMock.createStrictMock(Cache.class);
       
@@ -219,7 +216,7 @@
    public void concurrent() throws Exception
    {
       CacheContainerRegistry registry = EasyMock.createStrictMock(CacheContainerRegistry.class);
-      CacheContainer container = EasyMock.createStrictMock(CacheContainer.class);
+      EmbeddedCacheManager container = EasyMock.createStrictMock(EmbeddedCacheManager.class);
       @SuppressWarnings("unchecked")
       final Cache<Object, Object> cache = EasyMock.createStrictMock(Cache.class);
       
@@ -421,7 +418,7 @@
    public void getCacheChannelFactory() throws Exception
    {
       CacheContainerRegistry registry = EasyMock.createStrictMock(CacheContainerRegistry.class);
-      CacheContainer container = EasyMock.createStrictMock(CacheContainer.class);
+      EmbeddedCacheManager container = EasyMock.createStrictMock(EmbeddedCacheManager.class);
       @SuppressWarnings("unchecked")
       Cache<Object, Object> cache = EasyMock.createStrictMock(Cache.class);
       
@@ -460,7 +457,7 @@
    public void getChannelStackName() throws Exception
    {
       CacheContainerRegistry registry = EasyMock.createStrictMock(CacheContainerRegistry.class);
-      CacheContainer container = EasyMock.createStrictMock(CacheContainer.class);
+      EmbeddedCacheManager container = EasyMock.createStrictMock(EmbeddedCacheManager.class);
       @SuppressWarnings("unchecked")
       Cache<Object, Object> cache = EasyMock.createStrictMock(Cache.class);
       

Added: projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DefaultCacheSourceTest.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DefaultCacheSourceTest.java	                        (rev 0)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DefaultCacheSourceTest.java	2010-08-24 05:18:27 UTC (rev 107751)
@@ -0,0 +1,140 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.web.tomcat.service.session.distributedcache.ispn;
+
+import org.easymock.Capture;
+import org.easymock.EasyMock;
+import org.infinispan.Cache;
+import org.infinispan.config.Configuration;
+import org.infinispan.config.Configuration.CacheMode;
+import org.infinispan.manager.EmbeddedCacheManager;
+import org.jboss.ha.ispn.CacheContainerRegistry;
+import org.jboss.metadata.web.jboss.ReplicationConfig;
+import org.jboss.metadata.web.jboss.ReplicationMode;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author Paul Ferraro
+ *
+ */
+public class DefaultCacheSourceTest
+{
+   @Test
+   public void test()
+   {
+      Configuration configuration = new Configuration();
+      configuration.setCacheMode(CacheMode.REPL_ASYNC);
+      ReplicationConfig config = new ReplicationConfig();
+      config.setCacheName("session-cache");
+      config.setReplicationMode(null);
+      config.setBackups(null);
+      
+      // Validate host contribution to cache name
+      this.start(null, "session-cache", null, "", "localhost/ROOT", config, configuration, CacheMode.REPL_ASYNC);
+      this.start(null, "session-cache", "", "", "localhost/ROOT", config, configuration, CacheMode.REPL_ASYNC);
+      this.start(null, "session-cache", "host1", "", "host1/ROOT", config, configuration, CacheMode.REPL_ASYNC);
+
+      // Validate context path contribution to cache name
+      this.start(null, "session-cache", null, "/", "localhost/ROOT", config, configuration, CacheMode.REPL_ASYNC);
+      this.start(null, "session-cache", null, "/context1", "localhost/context1", config, configuration, CacheMode.REPL_ASYNC);
+      this.start(null, "session-cache", null, "/path/context1", "localhost/path/context1", config, configuration, CacheMode.REPL_ASYNC);
+      
+      // Validate cache container qualified cache name
+      config.setCacheName("default:session-cache");
+      this.start("default", "session-cache", null, "", "localhost/ROOT", config, configuration, CacheMode.REPL_ASYNC);
+      
+      config.setCacheName("session-cache");
+      config.setReplicationMode(ReplicationMode.SYNCHRONOUS);
+      this.start(null, "session-cache", null, "", "localhost/ROOT", config, configuration, CacheMode.REPL_SYNC);
+      
+      config.setReplicationMode(ReplicationMode.ASYNCHRONOUS);
+      this.start(null, "session-cache", null, "", "localhost/ROOT", config, configuration, CacheMode.REPL_ASYNC);
+      
+      config.setBackups(Integer.valueOf(-1));
+      config.setReplicationMode(null);
+      this.start(null, "session-cache", null, "", "localhost/ROOT", config, configuration, CacheMode.REPL_ASYNC);
+      
+      config.setReplicationMode(ReplicationMode.SYNCHRONOUS);
+      this.start(null, "session-cache", null, "", "localhost/ROOT", config, configuration, CacheMode.REPL_SYNC);
+      
+      config.setReplicationMode(ReplicationMode.ASYNCHRONOUS);
+      this.start(null, "session-cache", null, "", "localhost/ROOT", config, configuration, CacheMode.REPL_ASYNC);
+      
+      config.setBackups(Integer.valueOf(0));
+      config.setReplicationMode(null);
+      this.start(null, "session-cache", null, "", "localhost/ROOT", config, configuration, CacheMode.LOCAL);
+      
+      config.setReplicationMode(ReplicationMode.SYNCHRONOUS);
+      this.start(null, "session-cache", null, "", "localhost/ROOT", config, configuration, CacheMode.LOCAL);
+      
+      config.setReplicationMode(ReplicationMode.ASYNCHRONOUS);
+      this.start(null, "session-cache", null, "", "localhost/ROOT", config, configuration, CacheMode.LOCAL);
+      
+      config.setBackups(Integer.valueOf(1));
+      config.setReplicationMode(null);
+      this.start(null, "session-cache", null, "", "localhost/ROOT", config, configuration, CacheMode.DIST_ASYNC);
+      
+      config.setReplicationMode(ReplicationMode.SYNCHRONOUS);
+      this.start(null, "session-cache", null, "", "localhost/ROOT", config, configuration, CacheMode.DIST_SYNC);
+      
+      config.setReplicationMode(ReplicationMode.ASYNCHRONOUS);
+      this.start(null, "session-cache", null, "", "localhost/ROOT", config, configuration, CacheMode.DIST_ASYNC);
+   }
+   
+   private void start(String containerName, String templateCacheName, String hostName, String contextName, String cacheName, ReplicationConfig config, Configuration configuration, CacheMode mode)
+   {
+      CacheContainerRegistry registry = EasyMock.createStrictMock(CacheContainerRegistry.class);
+      @SuppressWarnings("unchecked")
+      Cache<Object, Object> cache = EasyMock.createStrictMock(Cache.class);
+      @SuppressWarnings("unchecked")
+      Cache<Object, Object> templateCache = EasyMock.createStrictMock(Cache.class);
+      EmbeddedCacheManager container = EasyMock.createStrictMock(EmbeddedCacheManager.class);
+      LocalDistributableSessionManager manager = EasyMock.createStrictMock(LocalDistributableSessionManager.class);
+      Capture<Configuration> capturedConfiguration = new Capture<Configuration>();
+      
+      DefaultCacheSource source = new DefaultCacheSource(registry);
+      
+      EasyMock.expect(manager.getReplicationConfig()).andReturn(config);
+      
+      EasyMock.expect(registry.getCacheContainer(containerName)).andReturn(container);
+      EasyMock.expect(manager.getHostName()).andReturn(hostName);
+      EasyMock.expect(manager.getContextName()).andReturn(contextName);
+      EasyMock.expect(container.getCache()).andReturn(templateCache);
+      EasyMock.expect(templateCache.getConfiguration()).andReturn(configuration);
+      EasyMock.expect(container.defineConfiguration(EasyMock.eq(cacheName), EasyMock.capture(capturedConfiguration))).andReturn(new Configuration());
+      EasyMock.expect(container.getCache(cacheName)).andReturn(cache);
+      
+      EasyMock.replay(registry, manager, container, cache, templateCache);
+      
+      Cache<Object, Object> result = source.getCache(manager);
+      
+      EasyMock.verify(registry, manager, container, cache, templateCache);
+      
+      Assert.assertSame(cache, result);
+      
+      Configuration cacheConfiguration = capturedConfiguration.getValue();
+      Assert.assertSame(mode, cacheConfiguration.getCacheMode());
+      Assert.assertEquals((config.getBackups() != null) ? config.getBackups().intValue() : 2, cacheConfiguration.getNumOwners());
+   }
+}

Modified: projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DistributedCacheManagerFactoryTest.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DistributedCacheManagerFactoryTest.java	2010-08-24 04:32:08 UTC (rev 107750)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DistributedCacheManagerFactoryTest.java	2010-08-24 05:18:27 UTC (rev 107751)
@@ -25,6 +25,10 @@
 import java.util.ServiceLoader;
 
 import org.easymock.EasyMock;
+import org.infinispan.AdvancedCache;
+import org.infinispan.atomic.AtomicMap;
+import org.infinispan.config.Configuration;
+import org.infinispan.transaction.tm.BatchModeTransactionManager;
 import org.jboss.ha.ispn.atomic.AtomicMapFactory;
 import org.jboss.ha.ispn.invoker.CacheInvoker;
 import org.jboss.metadata.web.jboss.ReplicationConfig;
@@ -46,6 +50,7 @@
  */
 public class DistributedCacheManagerFactoryTest
 {
+   private final CacheSource source = EasyMock.createStrictMock(CacheSource.class);
    private final SessionAttributeStorageFactory storageFactory = EasyMock.createStrictMock(SessionAttributeStorageFactory.class);
    private final SessionAttributeMarshallerFactory marshallerFactory = EasyMock.createStrictMock(SessionAttributeMarshallerFactory.class);
    private final CacheInvoker invoker = EasyMock.createStrictMock(CacheInvoker.class);
@@ -54,36 +59,44 @@
    private final SessionAttributeStorage<OutgoingDistributableSessionData> storage = EasyMock.createStrictMock(SessionAttributeStorage.class);
    private final SessionAttributeMarshaller marshaller = EasyMock.createStrictMock(SessionAttributeMarshaller.class);
    private final AtomicMapFactory atomicMapFactory = EasyMock.createStrictMock(AtomicMapFactory.class);
+   @SuppressWarnings("unchecked")
+   private final AdvancedCache<String, AtomicMap<Object, Object>> cache = EasyMock.createStrictMock(AdvancedCache.class);
    
    @Test
-   public void test() throws Exception
+   public void getDistributedCacheManager() throws Exception
    {
       DistributedCacheManagerFactory factory = new DistributedCacheManagerFactory();
       
-      factory.setAtomicMapFactory(atomicMapFactory);
+      factory.setAtomicMapFactory(this.atomicMapFactory);
       factory.setSessionAttributeStorageFactory(this.storageFactory);
       factory.setSessionAttributeMarshallerFactory(this.marshallerFactory);
       factory.setCacheInvoker(this.invoker);
       factory.setAtomicMapFactory(this.atomicMapFactory);
+      factory.setCacheSource(this.source);
       
       ReplicationConfig config = new ReplicationConfig();
       ReplicationGranularity granularity = ReplicationGranularity.SESSION;
       config.setReplicationGranularity(granularity);
       
+      EasyMock.expect(this.source.<String, AtomicMap<Object, Object>>getCache(this.manager)).andReturn(this.cache);
+      EasyMock.expect(this.cache.getAdvancedCache()).andReturn(this.cache);
+      EasyMock.expect(this.cache.getTransactionManager()).andReturn(new BatchModeTransactionManager());
+      EasyMock.expect(this.cache.getConfiguration()).andReturn(new Configuration());
+      
       EasyMock.expect(this.marshallerFactory.createMarshaller(this.manager)).andReturn(this.marshaller);
       EasyMock.expect(this.manager.getReplicationConfig()).andReturn(config);
       EasyMock.expect(this.storageFactory.createStorage(granularity, this.marshaller)).andReturn(this.storage);
       
-      EasyMock.replay(this.storageFactory, this.marshallerFactory, this.invoker, this.manager, this.storage, this.marshaller, this.atomicMapFactory);
+      EasyMock.replay(this.storageFactory, this.marshallerFactory, this.invoker, this.manager, this.storage, this.marshaller, this.atomicMapFactory, this.source, this.cache);
       
       org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager<?> result = factory.getDistributedCacheManager(this.manager);
       
-      EasyMock.verify(this.storageFactory, this.marshallerFactory, this.invoker, this.manager, this.storage, this.marshaller, this.atomicMapFactory);
+      EasyMock.verify(this.storageFactory, this.marshallerFactory, this.invoker, this.manager, this.storage, this.marshaller, this.atomicMapFactory, this.source, this.cache);
       
       Assert.assertNotNull(result);
       Assert.assertTrue(result instanceof DistributedCacheManager);
       
-      EasyMock.reset(this.storageFactory, this.marshallerFactory, this.invoker, this.manager, this.storage, this.marshaller, this.atomicMapFactory);
+      EasyMock.reset(this.storageFactory, this.marshallerFactory, this.invoker, this.manager, this.storage, this.marshaller, this.atomicMapFactory, this.source, this.cache);
    }
  
    @Test

Modified: projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DistributedCacheManagerTest.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DistributedCacheManagerTest.java	2010-08-24 04:32:08 UTC (rev 107750)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DistributedCacheManagerTest.java	2010-08-24 05:18:27 UTC (rev 107751)
@@ -27,33 +27,25 @@
 import org.easymock.Capture;
 import org.easymock.EasyMock;
 import org.infinispan.AdvancedCache;
-import org.infinispan.Cache;
 import org.infinispan.atomic.AtomicMap;
 import org.infinispan.config.Configuration;
-import org.infinispan.config.Configuration.CacheMode;
 import org.infinispan.context.Flag;
 import org.infinispan.distribution.DistributionManager;
 import org.infinispan.lifecycle.ComponentStatus;
-import org.infinispan.manager.CacheContainer;
-import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.notifications.cachelistener.event.CacheEntryActivatedEvent;
 import org.infinispan.notifications.cachelistener.event.CacheEntryModifiedEvent;
 import org.infinispan.notifications.cachelistener.event.CacheEntryRemovedEvent;
-import org.infinispan.transaction.tm.BatchModeTransactionManager;
-import org.jboss.ha.ispn.CacheContainerRegistry;
 import org.jboss.ha.ispn.atomic.AtomicMapFactory;
 import org.jboss.ha.ispn.invoker.CacheInvoker;
-import org.jboss.metadata.web.jboss.ReplicationConfig;
-import org.jboss.metadata.web.jboss.ReplicationMode;
-import org.jboss.web.tomcat.service.session.distributedcache.ispn.AtomicMapEntry;
-import org.jboss.web.tomcat.service.session.distributedcache.ispn.DistributedCacheManager;
-import org.jboss.web.tomcat.service.session.distributedcache.ispn.SessionAttributeStorage;
+import org.jboss.web.tomcat.service.session.distributedcache.spi.BatchingManager;
 import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributableSessionMetadata;
 import org.jboss.web.tomcat.service.session.distributedcache.spi.IncomingDistributableSessionData;
 import org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager;
 import org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData;
 import org.jboss.web.tomcat.service.session.distributedcache.spi.SessionOwnershipSupport;
+import org.junit.After;
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.Test;
 
 /**
@@ -62,176 +54,108 @@
  */
 public class DistributedCacheManagerTest
 {
-   private final CacheContainer container = EasyMock.createStrictMock(CacheContainer.class);
-   private final CacheContainerRegistry registry = EasyMock.createStrictMock(CacheContainerRegistry.class);
-   private final LocalDistributableSessionManager manager = EasyMock.createStrictMock(LocalDistributableSessionManager.class);
+   private final LocalDistributableSessionManager sessionManager = EasyMock.createStrictMock(LocalDistributableSessionManager.class);
    @SuppressWarnings("unchecked")
    private final SessionAttributeStorage<OutgoingDistributableSessionData> storage = EasyMock.createStrictMock(SessionAttributeStorage.class);
    @SuppressWarnings("unchecked")
    private final AdvancedCache<String, AtomicMap<Object, Object>> cache = EasyMock.createStrictMock(AdvancedCache.class);
+   private final BatchingManager batchingManager = EasyMock.createStrictMock(BatchingManager.class);
    private final CacheInvoker invoker = EasyMock.createStrictMock(CacheInvoker.class);
    private final AtomicMapFactory atomicMapFactory = EasyMock.createStrictMock(AtomicMapFactory.class);
+   private DistributedCacheManager<OutgoingDistributableSessionData> manager;
    
-   @Test
-   public void start()
+   @Before
+   public void before()
    {
       Configuration configuration = new Configuration();
-      configuration.setCacheMode(CacheMode.REPL_ASYNC);
-      ReplicationConfig config = new ReplicationConfig();
-      config.setCacheName("session-cache");
-      config.setReplicationMode(null);
-      config.setBackups(null);
-      
-      // Validate host contribution to cache name
-      this.start(null, "session-cache", null, "", "localhost/ROOT", config, ComponentStatus.INSTANTIATED, true, configuration, CacheMode.REPL_ASYNC);
-      this.start(null, "session-cache", "", "", "localhost/ROOT", config, ComponentStatus.INSTANTIATED, true, configuration, CacheMode.REPL_ASYNC);
-      this.start(null, "session-cache", "host1", "", "host1/ROOT", config, ComponentStatus.INSTANTIATED, true, configuration, CacheMode.REPL_ASYNC);
 
-      // Validate context path contribution to cache name
-      this.start(null, "session-cache", null, "/", "localhost/ROOT", config, ComponentStatus.INSTANTIATED, true, configuration, CacheMode.REPL_ASYNC);
-      this.start(null, "session-cache", null, "/context1", "localhost/context1", config, ComponentStatus.INSTANTIATED, true, configuration, CacheMode.REPL_ASYNC);
-      this.start(null, "session-cache", null, "/path/context1", "localhost/path/context1", config, ComponentStatus.INSTANTIATED, true, configuration, CacheMode.REPL_ASYNC);
+      EasyMock.expect(this.cache.getConfiguration()).andReturn(configuration);
       
-      // Validate starting of cache per cache status
-      this.start(null, "session-cache", null, "", "localhost/ROOT", config, ComponentStatus.FAILED, true, configuration, CacheMode.REPL_ASYNC);
-      this.start(null, "session-cache", null, "", "localhost/ROOT", config, ComponentStatus.INITIALIZING, true, configuration, CacheMode.REPL_ASYNC);
-      this.start(null, "session-cache", null, "", "localhost/ROOT", config, ComponentStatus.RUNNING, false, configuration, CacheMode.REPL_ASYNC);
-      this.start(null, "session-cache", null, "", "localhost/ROOT", config, ComponentStatus.STOPPING, true, configuration, CacheMode.REPL_ASYNC);
-      this.start(null, "session-cache", null, "", "localhost/ROOT", config, ComponentStatus.TERMINATED, true, configuration, CacheMode.REPL_ASYNC);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
-      // Validate cache container qualified cache name
-      config.setCacheName("default:session-cache");
-      this.start("default", "session-cache", null, "", "localhost/ROOT", config, ComponentStatus.INSTANTIATED, true, configuration, CacheMode.REPL_ASYNC);
+      this.manager = new DistributedCacheManager<OutgoingDistributableSessionData>(this.sessionManager, this.cache, this.storage, this.batchingManager, this.invoker, this.atomicMapFactory);
       
-      config.setCacheName("session-cache");
-      config.setReplicationMode(ReplicationMode.SYNCHRONOUS);
-      this.start(null, "session-cache", null, "", "localhost/ROOT", config, ComponentStatus.INSTANTIATED, true, configuration, CacheMode.REPL_SYNC);
-      
-      config.setReplicationMode(ReplicationMode.ASYNCHRONOUS);
-      this.start(null, "session-cache", null, "", "localhost/ROOT", config, ComponentStatus.INSTANTIATED, true, configuration, CacheMode.REPL_ASYNC);
-      
-      config.setBackups(Integer.valueOf(-1));
-      config.setReplicationMode(null);
-      this.start(null, "session-cache", null, "", "localhost/ROOT", config, ComponentStatus.INSTANTIATED, true, configuration, CacheMode.REPL_ASYNC);
-      
-      config.setReplicationMode(ReplicationMode.SYNCHRONOUS);
-      this.start(null, "session-cache", null, "", "localhost/ROOT", config, ComponentStatus.INSTANTIATED, true, configuration, CacheMode.REPL_SYNC);
-      
-      config.setReplicationMode(ReplicationMode.ASYNCHRONOUS);
-      this.start(null, "session-cache", null, "", "localhost/ROOT", config, ComponentStatus.INSTANTIATED, true, configuration, CacheMode.REPL_ASYNC);
-      
-      config.setBackups(Integer.valueOf(0));
-      config.setReplicationMode(null);
-      this.start(null, "session-cache", null, "", "localhost/ROOT", config, ComponentStatus.INSTANTIATED, true, configuration, CacheMode.LOCAL);
-      
-      config.setReplicationMode(ReplicationMode.SYNCHRONOUS);
-      this.start(null, "session-cache", null, "", "localhost/ROOT", config, ComponentStatus.INSTANTIATED, true, configuration, CacheMode.LOCAL);
-      
-      config.setReplicationMode(ReplicationMode.ASYNCHRONOUS);
-      this.start(null, "session-cache", null, "", "localhost/ROOT", config, ComponentStatus.INSTANTIATED, true, configuration, CacheMode.LOCAL);
-      
-      config.setBackups(Integer.valueOf(1));
-      config.setReplicationMode(null);
-      this.start(null, "session-cache", null, "", "localhost/ROOT", config, ComponentStatus.INSTANTIATED, true, configuration, CacheMode.DIST_ASYNC);
-      
-      config.setReplicationMode(ReplicationMode.SYNCHRONOUS);
-      this.start(null, "session-cache", null, "", "localhost/ROOT", config, ComponentStatus.INSTANTIATED, true, configuration, CacheMode.DIST_SYNC);
-      
-      config.setReplicationMode(ReplicationMode.ASYNCHRONOUS);
-      this.start(null, "session-cache", null, "", "localhost/ROOT", config, ComponentStatus.INSTANTIATED, true, configuration, CacheMode.DIST_ASYNC);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
+      this.reset();
    }
    
-   private DistributedCacheManager<OutgoingDistributableSessionData> start(String containerName, String templateCacheName, String hostName, String contextName, String cacheName, ReplicationConfig config, ComponentStatus cacheStatus, boolean startCache, Configuration configuration, CacheMode mode)
+   @After
+   public void reset()
    {
-      DistributedCacheManager<OutgoingDistributableSessionData> manager = new DistributedCacheManager<OutgoingDistributableSessionData>(this.manager, this.registry, this.storage, this.invoker, this.atomicMapFactory);
-      
-      @SuppressWarnings("unchecked")
-      Cache<Object, Object> cache = EasyMock.createStrictMock(Cache.class);
-      EmbeddedCacheManager cacheManager = EasyMock.createStrictMock(EmbeddedCacheManager.class);
-      Capture<Configuration> capturedConfiguration = new Capture<Configuration>();
-      
-      EasyMock.expect(this.manager.getReplicationConfig()).andReturn(config);
-      
-      EasyMock.expect(this.registry.getCacheContainer(containerName)).andReturn(this.container);
-      EasyMock.expect(this.manager.getHostName()).andReturn(hostName);
-      EasyMock.expect(this.manager.getContextName()).andReturn(contextName);
-      EasyMock.expect(this.container.getCache()).andReturn(cache);
-      EasyMock.expect(cache.getConfiguration()).andReturn(configuration);
-      EasyMock.expect(cache.getCacheManager()).andReturn(cacheManager);
-      EasyMock.expect(cacheManager.defineConfiguration(EasyMock.eq(cacheName), EasyMock.capture(capturedConfiguration))).andReturn(new Configuration());
-      EasyMock.expect(cacheManager.<String, AtomicMap<Object, Object>>getCache(cacheName)).andReturn(this.cache);
-      
+      EasyMock.reset(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
+   }
+   
+   @Test
+   public void start()
+   {
+      // Validate starting of cache per cache status
+      this.start(ComponentStatus.FAILED, true);
+      this.start(ComponentStatus.INITIALIZING, true);
+      this.start(ComponentStatus.RUNNING, false);
+      this.start(ComponentStatus.STOPPING, true);
+      this.start(ComponentStatus.TERMINATED, true);
+   }
+   
+   private void start(ComponentStatus cacheStatus, boolean startCache)
+   {
       EasyMock.expect(this.cache.getStatus()).andReturn(cacheStatus);
+      
       if (startCache)
       {
          this.cache.start();
       }
-      EasyMock.expect(this.cache.getAdvancedCache()).andReturn(this.cache);
-      EasyMock.expect(this.cache.getTransactionManager()).andReturn(new BatchModeTransactionManager());
-      this.cache.addListener(manager);
+
+      this.cache.addListener(EasyMock.same(this.manager));
       
-      EasyMock.expect(this.cache.getConfiguration()).andReturn(configuration);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
-      EasyMock.replay(this.registry, this.manager, this.container, this.storage, this.cache, this.invoker, cache, cacheManager);
+      this.manager.start();
       
-      manager.start();
-      
-      EasyMock.verify(this.registry, this.manager, this.container, this.storage, this.cache, this.invoker, cache, cacheManager);
-      
-      Assert.assertNotNull(manager.getBatchingManager());
-      
-      Configuration cacheConfiguration = capturedConfiguration.getValue();
-      Assert.assertSame(mode, cacheConfiguration.getCacheMode());
-      Assert.assertEquals((config.getBackups() != null) ? config.getBackups().intValue() : 2, cacheConfiguration.getNumOwners());
-      
-      EasyMock.reset(this.registry, this.manager, this.container, this.storage, this.cache, this.invoker, cache, cacheManager);
-      
-      return manager;
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
+      this.reset();
    }
    
-   private DistributedCacheManager<OutgoingDistributableSessionData> startDistributedCacheManager()
-   {
-      ReplicationConfig config = new ReplicationConfig();
-      config.setCacheName("session-cache");
-      
-      return this.start(null, "session-cache", null, "", "localhost/ROOT", config, ComponentStatus.INSTANTIATED, true, new Configuration(), CacheMode.LOCAL);
-   }
-   
    @Test
    public void stop()
    {
-      DistributedCacheManager<OutgoingDistributableSessionData> manager = this.startDistributedCacheManager();
-      
-      this.cache.removeListener(manager);
+      this.start(ComponentStatus.INSTANTIATED, true);
+
+      this.cache.removeListener(EasyMock.same(this.manager));
       this.cache.stop();
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
-      manager.stop();
+      this.manager.stop();
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker);
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
+      EasyMock.reset(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
+      
+      
+      this.start(ComponentStatus.RUNNING, false);
+
+      this.cache.removeListener(EasyMock.same(this.manager));
+      
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
+      
+      this.manager.stop();
+      
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
    }
    
    @Test
    public void sessionCreated()
    {
-      DistributedCacheManager<OutgoingDistributableSessionData> manager = this.startDistributedCacheManager();
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker);
+      this.manager.sessionCreated("abc");
       
-      manager.sessionCreated("abc");
-      
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker);
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
    }
    
    @Test
    public void storeSessionData()
    {
       OutgoingDistributableSessionData data = EasyMock.createNiceMock(OutgoingDistributableSessionData.class);
-      
-      DistributedCacheManager<OutgoingDistributableSessionData> manager = this.startDistributedCacheManager();
       @SuppressWarnings("unchecked")
       AtomicMap<Object, Object> map = EasyMock.createNiceMock(AtomicMap.class);
       Capture<DistributedCacheManager.Operation<AtomicMap<Object, Object>>> capturedOperation = new Capture<DistributedCacheManager.Operation<AtomicMap<Object, Object>>>();
@@ -253,27 +177,25 @@
       
       this.storage.store(EasyMock.same(map), EasyMock.same(data));
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker, this.atomicMapFactory, data, map);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, data, map);
       
-      manager.storeSessionData(data);
+      this.manager.storeSessionData(data);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker, this.atomicMapFactory, data, map);
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker, this.atomicMapFactory, data, map);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, data, map);
+      EasyMock.reset(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, data, map);
       
       
       DistributedCacheManager.Operation<AtomicMap<Object, Object>> operation = capturedOperation.getValue();
       
       EasyMock.expect(this.atomicMapFactory.getAtomicMap(EasyMock.same(cache), EasyMock.same(sessionId), EasyMock.eq(true))).andReturn(map);
             
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker, this.atomicMapFactory, data);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, data, map);
       
       AtomicMap<Object, Object> result = operation.invoke(this.cache);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker, this.atomicMapFactory, data);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, data, map);
       
       Assert.assertSame(map, result);
-      
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker, this.atomicMapFactory, data);
    }
    
    @Test
@@ -297,8 +219,6 @@
       Long timestamp = Long.valueOf(System.currentTimeMillis());
       DistributableSessionMetadata metadata = new DistributableSessionMetadata();
       
-      DistributedCacheManager<OutgoingDistributableSessionData> manager = this.startDistributedCacheManager();
-      
       EasyMock.expect(this.invoker.invoke(EasyMock.same(this.cache), EasyMock.capture(capturedOperation))).andReturn(map);
       
       EasyMock.expect(map.get(Byte.valueOf((byte) AtomicMapEntry.VERSION.ordinal()))).andReturn(version);
@@ -310,11 +230,11 @@
          EasyMock.expect(this.storage.load(map)).andReturn(attributes);
       }
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker, this.atomicMapFactory, map);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, map);
       
-      IncomingDistributableSessionData result = manager.getSessionData(sessionId, null, includeAttributes);
+      IncomingDistributableSessionData result = this.manager.getSessionData(sessionId, null, includeAttributes);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker, this.atomicMapFactory, map);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, map);
       
       Assert.assertNotNull(result);
       Assert.assertEquals(version.intValue(), result.getVersion());
@@ -343,7 +263,7 @@
          Assert.assertNotNull(exception);
       }
       
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker, this.atomicMapFactory, map);
+      EasyMock.reset(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, map);
       
       
       DistributedCacheManager.Operation<AtomicMap<Object, Object>> operation = capturedOperation.getValue();
@@ -352,15 +272,15 @@
       
       EasyMock.expect(this.atomicMapFactory.getAtomicMap(EasyMock.same(cache), EasyMock.same(sessionId), EasyMock.eq(false))).andReturn(expectedMap);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker, this.atomicMapFactory, expectedMap);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, map);
       
       AtomicMap<Object, Object> resultMap = operation.invoke(this.cache);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker, this.atomicMapFactory, expectedMap);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, map);
       
       Assert.assertSame(expectedMap, resultMap);
       
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker, this.atomicMapFactory, expectedMap);
+      this.reset();
    }
    
    @Test
@@ -375,19 +295,17 @@
    {
       Capture<DistributedCacheManager.Operation<AtomicMap<Object, Object>>> capturedOperation = new Capture<DistributedCacheManager.Operation<AtomicMap<Object, Object>>>();
       
-      DistributedCacheManager<OutgoingDistributableSessionData> manager = this.startDistributedCacheManager();
-      
       EasyMock.expect(this.invoker.invoke(EasyMock.same(this.cache), EasyMock.capture(capturedOperation))).andReturn(null);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker, this.atomicMapFactory);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
-      IncomingDistributableSessionData result = manager.getSessionData("abc", null, includeAttributes);
+      IncomingDistributableSessionData result = this.manager.getSessionData("abc", null, includeAttributes);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker, this.atomicMapFactory);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
       Assert.assertNull(result);
       
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker, this.atomicMapFactory);
+      EasyMock.reset(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
       
       DistributedCacheManager.Operation<AtomicMap<Object, Object>> operation = capturedOperation.getValue();
@@ -396,15 +314,15 @@
       
       EasyMock.expect(this.atomicMapFactory.getAtomicMap(this.cache, "abc", false)).andReturn(expectedMap);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker, this.atomicMapFactory);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
       AtomicMap<Object, Object> resultMap = operation.invoke(this.cache);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker, this.atomicMapFactory);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
       Assert.assertSame(expectedMap, resultMap);
       
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker, this.atomicMapFactory);
+      this.reset();
    }
    
    @Test
@@ -417,17 +335,15 @@
    
    private void getSessionDataWithOwner(boolean includeAttributes)
    {
-      DistributedCacheManager<OutgoingDistributableSessionData> manager = this.startDistributedCacheManager();
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker);
+      IncomingDistributableSessionData result = this.manager.getSessionData("abc", "owner1", includeAttributes);
       
-      IncomingDistributableSessionData result = manager.getSessionData("abc", "owner1", includeAttributes);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker);
-      
       Assert.assertNull(result);
       
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker);
+      this.reset();
    }
    
    @Test
@@ -437,16 +353,14 @@
       
       Capture<DistributedCacheManager.Operation<AtomicMap<Object, Object>>> capturedOperation = new Capture<DistributedCacheManager.Operation<AtomicMap<Object, Object>>>();
       
-      DistributedCacheManager<OutgoingDistributableSessionData> manager = this.startDistributedCacheManager();
-      
       EasyMock.expect(this.invoker.invoke(EasyMock.same(this.cache), EasyMock.capture(capturedOperation))).andReturn(null);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
-      manager.removeSession(sessionId);
+      this.manager.removeSession(sessionId);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker);
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
+      EasyMock.reset(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
       
       DistributedCacheManager.Operation<AtomicMap<Object, Object>> operation = capturedOperation.getValue();
@@ -455,15 +369,13 @@
       
       EasyMock.expect(this.cache.remove(sessionId)).andReturn(expectedMap);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
       AtomicMap<Object, Object> resultMap = operation.invoke(this.cache);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
       Assert.assertSame(expectedMap, resultMap);
-      
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker);
    }
    
    @Test
@@ -473,16 +385,14 @@
       
       Capture<DistributedCacheManager.Operation<AtomicMap<Object, Object>>> capturedOperation = new Capture<DistributedCacheManager.Operation<AtomicMap<Object, Object>>>();
       
-      DistributedCacheManager<OutgoingDistributableSessionData> manager = this.startDistributedCacheManager();
-      
       EasyMock.expect(this.invoker.invoke(EasyMock.same(this.cache), EasyMock.capture(capturedOperation))).andReturn(null);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
-      manager.removeSessionLocal(sessionId);
+      this.manager.removeSessionLocal(sessionId);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker);
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
+      EasyMock.reset(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
       
       DistributedCacheManager.Operation<AtomicMap<Object, Object>> operation = capturedOperation.getValue();
@@ -493,15 +403,13 @@
       EasyMock.expect(this.cache.withFlags(Flag.CACHE_MODE_LOCAL)).andReturn(this.cache);
       EasyMock.expect(this.cache.remove(sessionId)).andReturn(expectedMap);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
       AtomicMap<Object, Object> resultMap = operation.invoke(this.cache);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
       Assert.assertSame(expectedMap, resultMap);
-      
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker);
    }
    
    @Test
@@ -511,16 +419,14 @@
       
       Capture<DistributedCacheManager.Operation<AtomicMap<Object, Object>>> capturedOperation = new Capture<DistributedCacheManager.Operation<AtomicMap<Object, Object>>>();
       
-      DistributedCacheManager<OutgoingDistributableSessionData> manager = this.startDistributedCacheManager();
-      
       EasyMock.expect(this.invoker.invoke(EasyMock.same(this.cache), EasyMock.capture(capturedOperation))).andReturn(null);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
-      manager.removeSessionLocal(sessionId, null);
+      this.manager.removeSessionLocal(sessionId, null);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker);
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
+      EasyMock.reset(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
       
       DistributedCacheManager.Operation<AtomicMap<Object, Object>> operation = capturedOperation.getValue();
@@ -531,28 +437,23 @@
       EasyMock.expect(this.cache.withFlags(Flag.CACHE_MODE_LOCAL)).andReturn(this.cache);
       EasyMock.expect(this.cache.remove(sessionId)).andReturn(expectedMap);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
       AtomicMap<Object, Object> resultMap = operation.invoke(this.cache);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
       Assert.assertSame(expectedMap, resultMap);
-      
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker);
    }
    
    @Test
    public void removeSessionLocalWithOwner()
    {
-      DistributedCacheManager<OutgoingDistributableSessionData> manager = this.startDistributedCacheManager();
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker);
+      this.manager.removeSessionLocal("abc", "owner1");
       
-      manager.removeSessionLocal("abc", "owner1");
-      
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker);
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
    }
    
    @Test
@@ -562,31 +463,27 @@
       
       Capture<DistributedCacheManager.Operation<Void>> capturedOperation = new Capture<DistributedCacheManager.Operation<Void>>();
       
-      DistributedCacheManager<OutgoingDistributableSessionData> manager = this.startDistributedCacheManager();
-      
       EasyMock.expect(this.invoker.invoke(EasyMock.same(this.cache), EasyMock.capture(capturedOperation))).andReturn(null);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
-      manager.evictSession(sessionId);
+      this.manager.evictSession(sessionId);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker);
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
+      EasyMock.reset(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
       
       DistributedCacheManager.Operation<Void> operation = capturedOperation.getValue();
       
       this.cache.evict(sessionId);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
       Void result = operation.invoke(this.cache);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
       Assert.assertNull(result);
-      
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker);
    }
    
    @Test
@@ -596,65 +493,54 @@
       
       Capture<DistributedCacheManager.Operation<Void>> capturedOperation = new Capture<DistributedCacheManager.Operation<Void>>();
       
-      DistributedCacheManager<OutgoingDistributableSessionData> manager = this.startDistributedCacheManager();
-      
       EasyMock.expect(this.invoker.invoke(EasyMock.same(this.cache), EasyMock.capture(capturedOperation))).andReturn(null);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
-      manager.evictSession(sessionId, null);
+      this.manager.evictSession(sessionId, null);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker);
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
+      EasyMock.reset(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
       
       DistributedCacheManager.Operation<Void> operation = capturedOperation.getValue();
       
       this.cache.evict(sessionId);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
       Void result = operation.invoke(this.cache);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
       Assert.assertNull(result);
-      
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker);
    }
    
    @Test
    public void evictSessionLocalWithOwner()
    {
-      DistributedCacheManager<OutgoingDistributableSessionData> manager = this.startDistributedCacheManager();
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker);
+      this.manager.evictSession("abc", "owner1");
       
-      manager.evictSession("abc", "owner1");
-      
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker);
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
    }
    
    @Test
    public void getSessionIds()
    {
-      DistributedCacheManager<OutgoingDistributableSessionData> manager = this.startDistributedCacheManager();
-      
       EasyMock.expect(this.cache.keySet()).andReturn(Collections.singleton("abc"));
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
-      Map<String, String> result = manager.getSessionIds();
+      Map<String, String> result = this.manager.getSessionIds();
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
       Assert.assertNotNull(result);
       Assert.assertEquals(1, result.size());
       Assert.assertTrue(result.containsKey("abc"));
       Assert.assertNull(result.get("abc"));
-      
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker);
    }
    
    @Test
@@ -666,34 +552,28 @@
    
    private void setForceSynchronous(boolean forceSynchronous)
    {
-      DistributedCacheManager<OutgoingDistributableSessionData> manager = this.startDistributedCacheManager();
-      
       this.invoker.setForceSynchronous(forceSynchronous);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
-      manager.setForceSynchronous(forceSynchronous);
+      this.manager.setForceSynchronous(forceSynchronous);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker);
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
+      EasyMock.reset(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
    }
    
    @Test
    public void getSessionOwnershipSupport()
    {
-      DistributedCacheManager<OutgoingDistributableSessionData> manager = this.startDistributedCacheManager();
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker);
-      
       SessionOwnershipSupport support = manager.getSessionOwnershipSupport();
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
 // TODO when session ownership support is added, replace these assertions
       Assert.assertNull(support);
 //      Assert.assertSame(manager, support);
-      
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker);
    }
    
    @Test
@@ -701,42 +581,38 @@
    {
       CacheEntryRemovedEvent event = EasyMock.createNiceMock(CacheEntryRemovedEvent.class);
       
-      DistributedCacheManager<OutgoingDistributableSessionData> manager = this.startDistributedCacheManager();
-      
-      
       EasyMock.expect(event.isPre()).andReturn(true);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker, event);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, event);
       
-      manager.removed(event);
+      this.manager.removed(event);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker, event);
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker, event);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, event);
+      EasyMock.reset(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, event);
       
       
       EasyMock.expect(event.isPre()).andReturn(false);
       EasyMock.expect(event.isOriginLocal()).andReturn(true);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker, event);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, event);
       
-      manager.removed(event);
+      this.manager.removed(event);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker, event);
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker, event);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, event);
+      EasyMock.reset(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, event);
       
       
       EasyMock.expect(event.isPre()).andReturn(false);
       EasyMock.expect(event.isOriginLocal()).andReturn(false);
       EasyMock.expect(event.getKey()).andReturn("abc");
       
-      this.manager.notifyRemoteInvalidation("abc");
+      this.sessionManager.notifyRemoteInvalidation("abc");
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker, event);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, event);
       
-      manager.removed(event);
+      this.manager.removed(event);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker, event);
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker, event);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, event);
    }
    
    @Test
@@ -744,28 +620,25 @@
    {
       CacheEntryModifiedEvent event = EasyMock.createNiceMock(CacheEntryModifiedEvent.class);
       
-      DistributedCacheManager<OutgoingDistributableSessionData> manager = this.startDistributedCacheManager();
-      
-      
       EasyMock.expect(event.isPre()).andReturn(true);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker, event);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, event);
       
-      manager.modified(event);
+      this.manager.modified(event);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker, event);
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker, event);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, event);
+      EasyMock.reset(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, event);
       
       
       EasyMock.expect(event.isPre()).andReturn(false);
       EasyMock.expect(event.isOriginLocal()).andReturn(true);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker, event);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, event);
       
-      manager.modified(event);
+      this.manager.modified(event);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker, event);
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker, event);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, event);
+      EasyMock.reset(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, event);
       
       
       @SuppressWarnings("unchecked")
@@ -784,14 +657,13 @@
       EasyMock.expect(map.get(Byte.valueOf((byte) AtomicMapEntry.TIMESTAMP.ordinal()))).andReturn(timestamp);
       EasyMock.expect(map.get(Byte.valueOf((byte) AtomicMapEntry.METADATA.ordinal()))).andReturn(metadata);
       
-      EasyMock.expect(this.manager.sessionChangedInDistributedCache("abc", null, version.intValue(), timestamp.longValue(), metadata)).andReturn(false);
+      EasyMock.expect(this.sessionManager.sessionChangedInDistributedCache("abc", null, version.intValue(), timestamp.longValue(), metadata)).andReturn(false);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker, event, map);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, event, map);
       
-      manager.modified(event);
+      this.manager.modified(event);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker, event, map);
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker, event, map);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, event, map);
    }
    
    @Test
@@ -799,57 +671,51 @@
    {
       CacheEntryActivatedEvent event = EasyMock.createNiceMock(CacheEntryActivatedEvent.class);
       
-      DistributedCacheManager<OutgoingDistributableSessionData> manager = this.startDistributedCacheManager();
-      
       EasyMock.expect(event.isPre()).andReturn(true);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker, event);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, event);
       
-      manager.activated(event);
+      this.manager.activated(event);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker, event);
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker, event);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, event);
+      EasyMock.reset(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, event);
       
       
-      EasyMock.expect(this.manager.isPassivationEnabled()).andReturn(false);
+      EasyMock.expect(this.sessionManager.isPassivationEnabled()).andReturn(false);
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker, event);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, event);
       
-      manager.activated(event);
+      this.manager.activated(event);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker, event);
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker, event);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, event);
+      EasyMock.reset(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, event);
       
       
-      EasyMock.expect(this.manager.isPassivationEnabled()).andReturn(true);
-      this.manager.sessionActivated();
+      EasyMock.expect(this.sessionManager.isPassivationEnabled()).andReturn(true);
+      this.sessionManager.sessionActivated();
       
-      EasyMock.replay(this.manager, this.container, this.storage, this.cache, this.invoker, event);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, event);
       
-      manager.activated(event);
+      this.manager.activated(event);
       
-      EasyMock.verify(this.manager, this.container, this.storage, this.cache, this.invoker, event);
-      EasyMock.reset(this.manager, this.container, this.storage, this.cache, this.invoker, event);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, event);
    }
    
    @Test
    public void isLocalReplicationMode()
    {
-      DistributedCacheManager<OutgoingDistributableSessionData> manager = this.startDistributedCacheManager();
       String sessionId = "ABC123";
       
       EasyMock.expect(this.cache.getAdvancedCache()).andReturn(this.cache);
       EasyMock.expect(this.cache.getDistributionManager()).andReturn(null);
       
-      EasyMock.replay(this.cache);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
       boolean result = manager.isLocal(sessionId);
       
-      EasyMock.verify(this.cache);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory);
       
       Assert.assertTrue(result);
-      
-      EasyMock.reset(this.cache);
    }
    
    @Test
@@ -863,21 +729,20 @@
    {
       DistributionManager distManager = EasyMock.createStrictMock(DistributionManager.class);
       
-      DistributedCacheManager<OutgoingDistributableSessionData> manager = this.startDistributedCacheManager();
       String sessionId = "ABC123";
       
       EasyMock.expect(this.cache.getAdvancedCache()).andReturn(this.cache);
       EasyMock.expect(this.cache.getDistributionManager()).andReturn(distManager);
       EasyMock.expect(distManager.isLocal(sessionId)).andReturn(local);
       
-      EasyMock.replay(this.cache, distManager);
+      EasyMock.replay(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, distManager);
       
       boolean result = manager.isLocal(sessionId);
       
-      EasyMock.verify(this.cache, distManager);
+      EasyMock.verify(this.sessionManager, this.storage, this.cache, this.batchingManager, this.invoker, this.atomicMapFactory, distManager);
       
       Assert.assertEquals(local, result);
       
-      EasyMock.reset(this.cache, distManager);
+      this.reset();
    }
 }



More information about the jboss-cvs-commits mailing list