GlobalConfiguration global = local ? GlobalConfiguration.getNonClusteredDefault() : GlobalConfiguration.getClusteredDefault();
global.setClusterName("testing");
global.setCacheManagerName("container" + containerIndex++);
global.setStrictPeerToPeer(false);
Configuration config = new Configuration();
config.setInvocationBatchingEnabled(true);
config.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
config.setSyncReplTimeout(20000);
config.setLockAcquisitionTimeout(15000);
config.setCacheMode(local ? CacheMode.LOCAL : (totalReplication ? CacheMode.REPL_SYNC : CacheMode.DIST_SYNC));
CacheMode mode = config.getCacheMode();
config.setFetchInMemoryState(mode.isReplicated());
// Block for commits -- no races between test driver and replication
config.setSyncCommitPhase(true);
config.setSyncRollbackPhase(true);
if (passivationDir != null)
{
CacheLoaderManagerConfig managerConfig = new CacheLoaderManagerConfig();
managerConfig.setPassivation(true);
managerConfig.setPreload(!purgeCacheLoader);
FileCacheStoreConfig fileConfig = new FileCacheStoreConfig();
fileConfig.setLocation(passivationDir);
fileConfig.setFetchPersistentState(mode.isReplicated());
fileConfig.setPurgeOnStartup(purgeCacheLoader);
managerConfig.setCacheLoaderConfigs(Collections.<CacheLoaderConfig>singletonList(fileConfig));
config.setCacheLoaderManagerConfig(managerConfig);
}
final EmbeddedCacheManager sessionContainer = new DefaultCacheManager(global, config, false);
global = local ? GlobalConfiguration.getNonClusteredDefault() : GlobalConfiguration.getClusteredDefault();
global.setClusterName("testing-jvmroute");
global.setCacheManagerName("container" + containerIndex++);
global.setStrictPeerToPeer(false);
config = new Configuration();
config.setInvocationBatchingEnabled(true);
config.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
config.setSyncReplTimeout(20000);
config.setLockAcquisitionTimeout(15000);
config.setCacheMode(CacheMode.REPL_SYNC);
config.setFetchInMemoryState(true);
config.setSyncCommitPhase(true);
config.setSyncRollbackPhase(true);
final EmbeddedCacheManager jvmRouteContainer = new DefaultCacheManager(global, config, false);
return new EmbeddedCacheManager()
{