org.infinispan.Cache.stop()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(121)

本文整理了Java中org.infinispan.Cache.stop()方法的一些代码示例,展示了Cache.stop()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cache.stop()方法的具体详情如下:
包路径:org.infinispan.Cache
类名称:Cache
方法名:stop

Cache.stop介绍

暂无

代码示例

代码示例来源:origin: wildfly/wildfly

@Override
public void accept(Cache<K, V> cache) {
  cache.stop();
}

代码示例来源:origin: oVirt/ovirt-engine

@PreDestroy
public void destroy() {
  cache.stop();
}

代码示例来源:origin: org.jboss.cluster/jboss-ha-server-cache-ispn

@Override
public void stopService() throws Exception
{      
 this.cache.removeListener(this);
 
 this.cache.stop();
}

代码示例来源:origin: org.infinispan/infinispan-core

@AfterMethod(alwaysRun = true)
public void stopSecondCacheManager() {
 if (otherCacheManager != null) {
   otherCacheManager.getCache().stop();
   otherCacheManager.stop();
   otherCacheManager = null;
 }
}

代码示例来源:origin: org.infinispan/infinispan-core

public void testCacheStopTwice() {
 EmbeddedCacheManager localCacheManager = createCacheManager(false);
 try {
   Cache<String, String> cache = localCacheManager.getCache();
   cache.put("k", "v");
   cache.stop();
   cache.stop();
 } finally {
   TestingUtil.killCacheManagers(localCacheManager);
 }
}

代码示例来源:origin: org.infinispan/infinispan-core

@Test(timeOut = 10000)
public void writeOnStorage() {
 TestResourceTracker.testThreadStarted(this);
 cache = cacheManager.getCache(CACHE_NAME);
 cache.put("key1", "value");
 cache.stop();
 storeWasRun = true;
}

代码示例来源:origin: org.infinispan/infinispan-core

public void testUnhealthyStatusWhenUserCacheIsStopped() throws Exception {
 Cache testCache = cacheManager.getCache(CACHE_NAME, true);
 testCache.stop();
 HealthStatus healthStatus = clusterHealth.getHealthStatus();
 assertEquals(HealthStatus.UNHEALTHY, healthStatus);
}

代码示例来源:origin: org.infinispan/infinispan-core

private void killCache() {
 if (stopCacheOnly) {
   killedCache.stop();
 } else {
   manager(KILLED_INDEX).stop();
 }
 if (waitForStateTransfer) {
   TestingUtil.waitForNoRebalance(originatorCache, otherCache);
 }
}

代码示例来源:origin: org.infinispan/infinispan-core

@Test(expectedExceptions = IllegalLifecycleStateException.class)
public void testCacheStopFollowedByGetCache() {
 Cache cache = cacheManager.getCache();
 cache.put("k", "v");
 cache.stop();
 Cache cache2 = cacheManager.getCache();
 cache2.put("k", "v2");
}

代码示例来源:origin: org.infinispan/infinispan-core

public void testUnhealthyStatusWhenInternalCacheIsStopped() throws Exception {
 Cache internalCache = cacheManager.getCache(INTERNAL_CACHE_NAME, true);
 internalCache.stop();
 assertEquals(HealthStatus.UNHEALTHY, clusterHealth.getHealthStatus());
}

代码示例来源:origin: org.infinispan/infinispan-lucene-directory

@Test(expectedExceptions = CacheException.class, expectedExceptionsMessageRegExp = "Failed looking up TransactionManager: the cache is not running")
public void testLuceneIndexLockingWithStoppedCache() throws IOException {
 final String commonIndexName = "myIndex";
 Cache cache1 = cache(0, "lucene");
 cache(0, "lucene").stop();
 cache(1, "lucene").stop();
 TestingUtil.killCacheManagers(cacheManagers);
 LockFactory lockFactory = makeLockFactory();
 lockFactory.obtainLock(new DirectoryBuilderImpl(cache1,cache1,cache1,commonIndexName).create(),"myLock");
}

代码示例来源:origin: org.infinispan/infinispan-core

@Test(expectedExceptions = IllegalLifecycleStateException.class)
public void testCacheStopFollowedByCacheOp() {
 cacheManager.defineConfiguration("big", cacheManager.getDefaultCacheConfiguration());
 Cache cache = cacheManager.getCache("big");
 cache.put("k", "v");
 cache.stop();
 cache.put("k", "v2");
}

代码示例来源:origin: org.infinispan/infinispan-core

@Test
public void sequantialOvewritingInBatches() {
 cache = cacheManager.getCache();
 AdvancedCache<Object,Object> advancedCache = cache.getAdvancedCache();
 for (int i = 0; i < 2000;) {
   advancedCache.startBatch();
   putAValue(advancedCache, i++);
   putAValue(advancedCache, i++);
   advancedCache.endBatch(true);
 }
 cacheCopy.putAll(cache);
 cache.stop();
 cacheManager.stop();
}

代码示例来源:origin: org.infinispan/infinispan-core

@Test
public void testExplicitStop() {
 cacheManager.defineConfiguration("A", new ConfigurationBuilder().build());
 cacheManager.defineConfiguration("B", new ConfigurationBuilder().build());
 Cache<?, ?> cacheA = cacheManager.getCache("A");
 Cache<?, ?> cacheB = cacheManager.getCache("B");
 cacheManager.addCacheDependency("A", "B");
 cacheB.stop();
 cacheA.stop();
 assertAllTerminated(cacheA, cacheB);
}

代码示例来源:origin: org.infinispan/infinispan-core

@Test(expectedExceptions = IllegalLifecycleStateException.class)
public void testCacheStopManagerStopFollowedByCacheOp() {
 EmbeddedCacheManager localCacheManager = createCacheManager(false);
 try {
   Cache<String, String> cache = localCacheManager.getCache();
   cache.put("k", "v");
   cache.stop();
   localCacheManager.stop();
   cache.put("k", "v2");
 } finally {
   TestingUtil.killCacheManagers(localCacheManager);
 }
}

代码示例来源:origin: org.infinispan/infinispan-core

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));
}

代码示例来源:origin: org.infinispan/infinispan-cachestore-rest

@Override
  public void call() {
   Cache<Object, Object> cache = cm.getCache();
   CacheLoader cacheLoader = TestingUtil.getCacheLoader(cache);
   assertSame(RestStore.class, cacheLoader.getClass());
   cache.put("k", "v");
   assertEquals(1, cacheManager.getCache().size());
   cache.stop();
   assertEquals(1, cacheManager.getCache().size());
  }
});

代码示例来源:origin: org.infinispan/infinispan-core

@Test
public void testDependencyOnStoppedCaches() {
 cacheManager.defineConfiguration("A", new ConfigurationBuilder().build());
 cacheManager.defineConfiguration("B", new ConfigurationBuilder().build());
 Cache<?, ?> cacheA = cacheManager.getCache("A");
 Cache<?, ?> cacheB = cacheManager.getCache("B");
 cacheA.stop();
 cacheManager.addCacheDependency("A", "B");
 CacheEventListener listener = new CacheEventListener();
 cacheManager.addListener(listener);
 cacheManager.stop();
 assertAllTerminated(cacheA, cacheB);
 assertEquals(Arrays.asList("B", GlobalConfigurationManager.CONFIG_STATE_CACHE_NAME, DEFAULT_CACHE_NAME), listener.stopOrder);
}

代码示例来源:origin: org.infinispan/infinispan-core

public void testStoppedCacheForDistributedExecutor() {
 ConfigurationBuilder config = TestCacheManagerFactory.getDefaultCacheConfiguration(true);
 config.clustering().cacheMode(CacheMode.REPL_SYNC);
 EmbeddedCacheManager cacheManager = TestCacheManagerFactory.createClusteredCacheManager(config);
 try {
   Cache<Object, Object> cache = cacheManager.getCache();
   cache.stop();
   expectException(IllegalStateException.class, () -> new DefaultExecutorService(cache));
 } finally {
   TestingUtil.killCacheManagers(cacheManager);
 }
}

代码示例来源:origin: org.infinispan/infinispan-cachestore-remote

@Override
  public void call() {
   Cache<Object, Object> cache = cm.getCache();
   CacheLoader cacheLoader = TestingUtil.getCacheLoader(cache);
   assert cacheLoader != null;
   assert cacheLoader instanceof RemoteStore;
   cache.put("k", "v");
   assertEquals(1, cacheManager.getCache().size());
   cache.stop();
   assertEquals(1, cacheManager.getCache().size());
  }
});

相关文章