protected CacheLoader resolveCacheLoader() { CacheLoader cl = null; if (cacheLoaderManager != null && cacheLoaderManager.isEnabled()) { cl = cacheLoaderManager.getCacheLoader(); } return cl; }
public static CacheLoader getCacheLoader(Cache cache) { CacheLoaderManager clm = extractComponent(cache, CacheLoaderManager.class); if (clm != null && clm.isEnabled()) { return clm.getCacheLoader(); } else { return null; } }
public static void clearCacheLoader(Cache cache) { CacheLoaderManager cacheLoaderManager = TestingUtil.extractComponent(cache, CacheLoaderManager.class); if (cacheLoaderManager != null && cacheLoaderManager.getCacheStore() != null) { try { cacheLoaderManager.getCacheStore().clear(); } catch (Exception e) { throw new RuntimeException(e); } } }
@Override public Object perform(InvocationContext ctx) throws Throwable { // To avoid reliance of a thread local flag, get a reference for the // cache store to be able to clear it after cache has stopped. CacheStore store = cacheLoaderManager.getCacheStore(); cacheManager.getCache(cacheName).stop(); // After stopping the cache, clear it if (store != null) store.clear(); registry.removeCache(cacheName); return null; }
public CacheStore getCacheStoreForRehashing() { if (cacheLoaderManager == null || !cacheLoaderManager.isEnabled() || cacheLoaderManager.isShared()) return null; return cacheLoaderManager.getCacheStore(); }
CountingCacheStore getCacheStore(Cache cache) { CacheLoaderManager clm = TestingUtil.extractComponent(cache, CacheLoaderManager.class); ChainingCacheStore ccs = (ChainingCacheStore) clm.getCacheLoader(); return (CountingCacheStore) ccs.getStores().keySet().iterator().next(); }
/** * Obtains the CacheStore that will be used for purging segments that are no longer owned by this * node. The CacheStore will be purged only if it is enabled and it is not shared. */ private CacheStore getCacheStore() { if (cacheLoaderManager.isEnabled() && !cacheLoaderManager.isShared()) { return cacheLoaderManager.getCacheStore(); } return null; }
// Must run after the CacheLoaderManager @Start(priority = 20) public void start() { isFetchEnabled = configuration.clustering().stateTransfer().fetchInMemoryState() || cacheLoaderManager.isFetchPersistentState(); }