String cacheName = getCacheName(manager);
Cache<Object, Object> cache = container.getCache(cacheName);
JGroupsTransport transport = (JGroupsTransport) cache.getAdvancedCache().getRpcManager().getTransport();
Channel channel = transport.getChannel();
CoreGroupCommunicationService gcs = new CoreGroupCommunicationService();
gcs.setChannel(channel);
gcs.setScopeId(SCOPE_ID);
try
{
gcs.start();
}
catch (Exception e)
{
throw new IllegalStateException("Unexpected exception while starting group communication service for " + containerName);
}
lockManager = new SharedLocalYieldingClusterLockManager(SERVICE_NAME, gcs, gcs);
try
{
lockManager.start();
this.lockManagers.put(containerName, lockManager);
}
catch (Exception e)
{
gcs.stop();
throw new IllegalStateException("Unexpected exception while starting lock manager for " + containerName);
}
}
return lockManager;