@Override public Cache<K, V> get() { Cache<K, V> cache = this.container.get().getCache(this.cacheName); cache.start(); return cache; }
treeCache = f.createTreeCache(cache); cache.start();
public Object run() { cache.start(); return null; } };
@Override public void load() { cache.start(); cache.addListener(karmaEventListener); log.fine("Plugin karma-plugin enabled."); }
@Override public void clear() { this.cache.stop(); this.cache.start(); }
@Override public Cache<K, V> get() { Cache<K, V> cache = this.container.get().getCache(this.cacheName); cache.start(); return cache; }
public static <K, V> Cache<K, V> startCache(final EmbeddedCacheManager container, final String name, final String configurationName) { PrivilegedAction<Cache<K, V>> action = () -> { Cache<K, V> cache = container.getCache(name, configurationName); cache.start(); return cache; }; return doPrivileged(action); }
public void startCache() { if (isStarted.compareAndSet(false, true)) { logger.info("Starting JBoss Cache " + name + " ..."); this.cache.start(); if (logger.isInfoEnabled()) { logger.info("Mobicents Cache " + name + " started, status: " + cache.getStatus() + ", Mode: " + cache.getCacheConfiguration().clustering().cacheMode()); } } }
public Cache<K, V> run() { Cache<K, V> cache = manager.getCache(regionIdEscaped); if (cache.getStatus() == ComponentStatus.TERMINATED) { cache.start(); LOG.info("The cache corresponding to the region {} was in state Terminated, so it has been restarted", regionIdEscaped); } return cache; } };
@BeforeMethod public void beforeTest() throws IOException { for (int i = 0; i < NUM_NODES; i++) { DefaultCacheManager node = new DefaultCacheManager(CONFIGURATION); node.start(); //Start all its caches: node.getCache("index_metadata").start(); node.getCache("index_data").start(); node.getCache("index_locks").start(); cacheManagers.put(i, node); } }
public void initialize(Cache infinispanCache, boolean attachLifespanToLeafNodes, long leafNodeLifespan, long staleNodesLinksCleanerDelay) { this.cache = new IDMTreeCacheImpl(infinispanCache, attachLifespanToLeafNodes, leafNodeLifespan, staleNodesLinksCleanerDelay); ComponentStatus status = infinispanCache.getStatus(); if (status.startAllowed()) { this.cache.getCache().start(); } log.info("Infinispan cache for Picketlink IDM created successfuly. cache name: " + cache.getCache().getName()); }
protected void startup() { long startTime = System.currentTimeMillis(); log.warn("Starting cache"); cache.start(); long duration = System.currentTimeMillis() - startTime; log.warn("Started cache. " + printDuration(duration)); }
@Override public Cache find(String name) { Cache result = null; if (manager().isRunning(name)) { result = manager().getCache(name); if (!result.getStatus().allowInvocations()) { result.start(); } } return result; }
@Override public void startService() throws Exception { CacheContainer container = this.cacheHandler.getCacheContainer(); this.cache = (this.cacheName != null) ? container.<Serializable, Serializable>getCache(this.cacheName) : container.<Serializable, Serializable>getCache(); if (!this.cache.getStatus().allowInvocations()) { this.cache.start(); } this.cache.addListener(this); }
@Test public void testIndexingParametersForNamedCache() { Cache<Object, Object> inMemory = manager.getCache("memory-searchable"); inMemory.start(); assertFalse(inMemory.getCacheConfiguration().indexing().properties().isEmpty(), "should contain definition from xml"); }
@Test public void testPreloadOnStart() throws PersistenceException { Cache<Object, Object> cache = caches().get(0); TestDeltaAware value = new TestDeltaAware(); value.setFirstComponent("1st"); value.setSecondComponent("2nd"); cache.put(1, value); cache.stop(); cache.start(); TestDeltaAware deltaAware = (TestDeltaAware) cache.get(1); assertEquals("1st", deltaAware.getFirstComponent()); assertEquals("2nd", deltaAware.getSecondComponent()); }
public void testEntrySetAfterExpiryWithStore() throws Exception { ConfigurationBuilder cb = TestCacheManagerFactory.getDefaultCacheConfiguration(false); createCacheStoreConfig(cb.persistence(), true); cacheManager.defineConfiguration("testEntrySetAfterExpiryWithStore", cb.build()); Cache<String, String> cache = cacheManager.getCache("testEntrySetAfterExpiryWithStore"); cache.start(); cache.clear(); assertEquals(cache.entrySet().size(), 0); Map dataIn = new HashMap(); dataIn.put(1, 1); dataIn.put(2, 2); cache.putAll(dataIn, EXPIRATION_TIMEOUT, TimeUnit.MILLISECONDS); Thread.sleep(EXPIRATION_TIMEOUT + 1000); assertEquals(cache.entrySet().size(), 0); }
public void testCacheRestart() throws Exception { final Cache<Integer, String> cache0 = cache(0); final Cache<Integer, String> cache1 = cache(1); // Restart the cache cache1.stop(); cache1.start(); cache1.put(1, "value1"); assertEquals("value1", cache0.get(1)); }
public void testInitialStateTransferAfterRestart(Method m) throws Exception { testCount++; logTestStart(m); Cache<Object, Object> cache1, cache2; cache1 = createCacheManager(cacheName).getCache(cacheName); writeInitialData(cache1); EmbeddedCacheManager cm2 = createCacheManager(cacheName); cache2 = cm2.getCache(cacheName); TestingUtil.waitForNoRebalance(cache1, cache2); verifyInitialData(cache2); cache2.stop(); cache2.start(); verifyInitialData(cache2); logTestEnd(m); }
public void testPersistence() throws PersistenceException { cache.put("k", "v"); assertEquals("v", cache.get("k")); cache.evict("k"); assertTrue(store.contains(getInternalKey("k"))); assertEquals("v", cache.get("k")); assertFalse(store.contains(getInternalKey("k"))); cache.stop(); cache.start(); // The old store's marshaller is not working any more store = (AdvancedLoadWriteStore) TestingUtil.getCacheLoader(cache); assertTrue(store.contains(getInternalKey("k"))); assertEquals("v", cache.get("k")); assertFalse(store.contains(getInternalKey("k"))); }