@Override
public void removeCache(String cacheName) {
authzHelper.checkPermission(AuthorizationPermission.ADMIN);
ComponentRegistry cacheComponentRegistry = globalComponentRegistry.getNamedComponentRegistry(cacheName);
if (cacheComponentRegistry != null) {
RemoveCacheCommand cmd = new RemoveCacheCommand(cacheName, this, globalComponentRegistry,
cacheComponentRegistry.getComponent(PersistenceManager.class),
cacheComponentRegistry.getComponent(CacheJmxRegistration.class));
Transport transport = getTransport();
try {
if (transport != null) {
Configuration c = getConfiguration(cacheName);
// Use sync replication timeout
transport.invokeRemotely(null, cmd, ResponseMode.SYNCHRONOUS, c.clustering().sync().replTimeout(), false, null, false, false);
}
// Once sent to the cluster, remove the local cache
cmd.perform(null);
// Remove cache configuration and remove it from the computed cache name list
configurationOverrides.remove(cacheName);
// Remove cache from dependency graph
cacheDependencyGraph.remove(cacheName);