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()
{
@Override
public <K, V> Cache<K, V> getCache()
{
return sessionContainer.getCache();
}
@Override
public <K, V> Cache<K, V> getCache(String cacheName)
{
return cacheName.equals("jboss.web") ? jvmRouteContainer.<K, V>getCache() : sessionContainer.<K, V>getCache(cacheName);
}
@Override
public void start()
{
jvmRouteContainer.start();
sessionContainer.start();
}
@Override
public void stop()
{
sessionContainer.stop();
jvmRouteContainer.stop();
}
@Override
public void addListener(Object listener)
{
sessionContainer.addListener(listener);
}
@Override
public void removeListener(Object listener)
{
sessionContainer.removeListener(listener);
}
@Override
public Set<Object> getListeners()
{
return sessionContainer.getListeners();
}
@Override
public Configuration defineConfiguration(String cacheName, Configuration configurationOverride)
{
return sessionContainer.defineConfiguration(cacheName, configurationOverride);
}
@Override
public Configuration defineConfiguration(String cacheName, String templateCacheName, Configuration configurationOverride)
{
return sessionContainer.defineConfiguration(cacheName, templateCacheName, configurationOverride);
}
@Override
public String getClusterName()
{
return sessionContainer.getClusterName();
}
@Override
public List<Address> getMembers()
{
return sessionContainer.getMembers();
}
@Override
public Address getAddress()
{
return sessionContainer.getAddress();
}
@Override
public boolean isCoordinator()
{
return sessionContainer.isCoordinator();
}
@Override
public ComponentStatus getStatus()
{
return sessionContainer.getStatus();
}
@Override
public GlobalConfiguration getGlobalConfiguration()
{
return sessionContainer.getGlobalConfiguration();
}
@Override
public Configuration getDefaultConfiguration()
{
return sessionContainer.getDefaultConfiguration();
}
@Override
public Set<String> getCacheNames()
{
return sessionContainer.getCacheNames();
}
@Override
public Address getCoordinator()
{
return sessionContainer.getCoordinator();
}
@Override
public boolean isRunning(String cacheName)
{
return cacheName.equals("jboss.web") ? jvmRouteContainer.isDefaultRunning() : sessionContainer.isRunning(cacheName);
}
@Override
public boolean isDefaultRunning()
{