@Override
public void disableCacheStore(String loaderType) {
if (isEnabled()) {
boolean disableInterceptors = false;
ComponentRegistry cr = cache.getComponentRegistry();
CacheLoaderInterceptor cli = cr.getComponent(CacheLoaderInterceptor.class);
CacheStoreInterceptor csi = cr.getComponent(CacheStoreInterceptor.class);
if (loader instanceof ChainingCacheStore) {
ChainingCacheStore ccs = (ChainingCacheStore) loader;
ccs.removeCacheLoader(loaderType);
if (ccs.getStores().isEmpty()) disableInterceptors = true;
} else {
String loaderClassName = undelegateCacheLoader(loader).getClass().getName();
if (loaderClassName.equals(loaderType)) {
try {
log.debugf("Stopping and removing cache loader %s", loaderType);
loader.stop();
} catch (Exception e) {
log.infof("Problems shutting down cache loader %s", loaderType, e);
}
disableInterceptors = true;
}
}
if (disableInterceptors) {
cli.disableInterceptor();
csi.disableInterceptor();
cache.removeInterceptor(cli.getClass());
cache.removeInterceptor(csi.getClass());
clmConfig = null;
}
}
}