本文整理了Java中org.infinispan.Cache.getStatus()
方法的一些代码示例,展示了Cache.getStatus()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cache.getStatus()
方法的具体详情如下:
包路径:org.infinispan.Cache
类名称:Cache
方法名:getStatus
暂无
代码示例来源:origin: wildfly/wildfly
@Override
public ModelNode execute(Cache<?, ?> cache) {
return new ModelNode(cache.getStatus().toString());
}
},
代码示例来源:origin: org.infinispan/infinispan-core
private void assertAllTerminated(Cache<?, ?>... caches) {
for (Cache<?, ?> cache : caches) {
assert cache.getStatus() == ComponentStatus.TERMINATED;
}
}
}
代码示例来源:origin: org.wildfly/wildfly-clustering-infinispan-extension
@Override
public ModelNode execute(Cache<?, ?> cache) {
return new ModelNode(cache.getStatus().toString());
}
},
代码示例来源:origin: org.infinispan/infinispan-gui-demo
private void updateTitleBar() {
String title = "Infinispan GUI Demo";
if (cache != null && cache.getStatus() == ComponentStatus.RUNNING) {
title += " (STARTED) " + getLocalAddress() + " Cluster size: " + getClusterSize();
} else {
title += " (STOPPED)";
}
frame.setTitle(title);
}
代码示例来源:origin: org.restcomm.cluster/cache
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());
}
}
}
代码示例来源:origin: org.infinispan/infinispan-server-hotrod
void detectCrashedMember(ViewChangedEvent e) {
try {
if (addressCache.getStatus().allowInvocations()) {
List<Address> goneMembers = e.getOldMembers().stream().filter(o -> !e.getNewMembers().contains(o)).collect(Collectors.toList());
log.tracef("View change received: %s, removing members %s", e, goneMembers);
// Consider doing removeAsync and then waiting for all removals...
goneMembers.forEach(addressCache::remove);
}
} catch (Throwable t) {
log.errorDetectingCrashedMember(t);
}
}
代码示例来源:origin: org.mobicents.cluster/cache
public void startCache() {
if(!(jBossDefaultCache.getCache().getStatus() == ComponentStatus.RUNNING)){
logger.info("Starting JBoss Cache...");
jBossDefaultCache.start();
}
if (logger.isInfoEnabled()) {
logger.info("Mobicents Cache started, status: " + this.jBossDefaultCache.getCache().getStatus() + ", Mode: " + jBossDefaultCache.getCache().getCacheConfiguration().clustering().cacheMode());
}
}
代码示例来源:origin: org.exoplatform.jcr/exo.jcr.component.core
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;
}
};
代码示例来源:origin: org.infinispan/infinispan-core
private void mockRehashInProgress(String cacheName, Cache mockedCache, AdvancedCache mockedAdvancedCache, DistributionManager mockedDistributionManager) {
when(mockedCacheManager.getCache(cacheName, false)).thenReturn(mockedCache);
when(mockedCache.getAdvancedCache()).thenReturn(mockedAdvancedCache);
when(mockedCache.getStatus()).thenReturn(INSTANTIATED);
when(mockedAdvancedCache.getDistributionManager()).thenReturn(mockedDistributionManager);
when(mockedDistributionManager.isRehashInProgress()).thenReturn(true);
}
代码示例来源:origin: org.picketlink.idm/picketlink-idm-cache
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());
}
代码示例来源:origin: org.keycloak/keycloak-model-infinispan
protected boolean shouldUpdateLocalCache(ClientEvent.Type type, K key, boolean commandRetried) {
boolean result;
// Case when cache is stopping or stopped already
if (!cache.getStatus().allowInvocations()) {
return false;
}
if (commandRetried) {
result = true;
} else {
result = topologyInfo.amIOwner(cache, key);
}
logger.debugf("Received event from remote store. Event '%s', key '%s', skip '%b'", type.toString(), key, !result);
return result;
}
代码示例来源:origin: org.keycloak/keycloak-model-infinispan
@Override
public void eventReceived(ClusterEvent event) {
KeycloakModelUtils.runJobInTransaction(sessionFactory, (KeycloakSession session) -> {
InfinispanAuthenticationSessionProvider provider = (InfinispanAuthenticationSessionProvider) session.getProvider(AuthenticationSessionProvider.class,
InfinispanAuthenticationSessionProviderFactory.PROVIDER_ID);
SE sessionEvent = (SE) event;
if (!provider.getCache().getStatus().allowInvocations()) {
log.debugf("Cache in state '%s' doesn't allow invocations", provider.getCache().getStatus());
return;
}
log.debugf("Received authentication session event '%s'", sessionEvent.toString());
eventReceived(session, provider, sessionEvent);
});
}
代码示例来源:origin: org.infinispan.server/infinispan-server-infinispan
@Override
public void stop(StopContext context) {
if ((this.cache != null) && this.cache.getStatus().allowInvocations()) {
if (this.recovery != null) {
this.dependencies.getRecoveryRegistry().removeXAResourceRecovery(this.recovery);
}
SecurityActions.stopCache(cache);
log.debugf("%s cache stopped", this.name);
}
}
代码示例来源:origin: org.infinispan/infinispan-core
private static Set<Cache> getRunningCaches(EmbeddedCacheManager cacheContainer) {
if (cacheContainer == null || !cacheContainer.getStatus().allowInvocations())
return Collections.emptySet();
Set<String> running = new LinkedHashSet<>(getOrderedCacheNames(cacheContainer));
extractGlobalComponent(cacheContainer, InternalCacheRegistry.class).filterPrivateCaches(running);
running.addAll(cacheContainer.getCacheNames());
running.add(cacheContainer.getCacheManagerConfiguration().defaultCacheName().orElse(DEFAULT_CACHE_NAME));
return running.stream()
.map(s -> cacheContainer.getCache(s, false))
.filter(Objects::nonNull)
.filter(c -> c.getStatus().allowInvocations())
.collect(Collectors.toCollection(LinkedHashSet::new));
}
代码示例来源:origin: org.projectodd.wunderboss/wunderboss-caching
@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;
}
代码示例来源:origin: org.jboss.cluster/jboss-ha-server-cache-ispn
@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);
}
代码示例来源:origin: org.infinispan/infinispan-core
public void testStopClearsData() {
String key = "key", value = "value";
cache.put(key, value);
assertEquals(value, cache.get(key));
assertCacheSize(1);
assertTrue(cache.keySet().contains(key));
assertTrue(cache.values().contains(value));
cache.stop();
assertEquals(ComponentStatus.TERMINATED, cache.getStatus());
cache.start();
assertFalse(cache.containsKey(key));
assertFalse(cache.keySet().contains(key));
assertFalse(cache.values().contains(value));
assertCacheIsEmpty();
}
代码示例来源:origin: org.infinispan/infinispan-core
public void testDefaultCache() {
EmbeddedCacheManager cm = createCacheManager(false);
try {
assertEquals(ComponentStatus.RUNNING, cm.getCache().getStatus());
assertTrue(cm.getCache().getName().equals(CacheContainer.DEFAULT_CACHE_NAME));
expectException(IllegalArgumentException.class,
() -> cm.defineConfiguration(CacheContainer.DEFAULT_CACHE_NAME,
new ConfigurationBuilder().build()));
} finally {
TestingUtil.killCacheManagers(cm);
}
}
代码示例来源:origin: org.infinispan/infinispan-hibernate-cache-commons
@Test
public void testRedeployment() throws Exception {
addEntityCheckCache( sessionFactory() );
bindToJndi = false;
rebuildSessionFactory();
addEntityCheckCache( sessionFactory() );
TestRegionFactory regionFactory = TestRegionFactoryProvider.load().wrap(sessionFactory().getSettings().getRegionFactory());
Cache cache = regionFactory.getCacheManager().getCache( Item.class.getName() );
assertEquals( ComponentStatus.RUNNING, cache.getStatus() );
}
代码示例来源:origin: org.infinispan/infinispan-core
public void testTransactionalReplace(Method m) throws Exception {
assertEquals(ComponentStatus.RUNNING, cache.getStatus());
assertNotInCacheAndStore(k(m, 1));
assertNotInCacheAndStore(k(m, 2));
cache.put(k(m, 2), v(m));
tm.begin();
cache.put(k(m, 1), v(m, 1));
cache.replace(k(m, 2), v(m, 1));
Transaction t = tm.suspend();
assertNotInCacheAndStore(k(m, 1));
assertInCacheAndStore(k(m, 2), v(m));
tm.resume(t);
tm.commit();
assertInCacheAndStore(k(m, 1), v(m, 1));
assertInCacheAndStore(k(m, 2), v(m, 1));
}
内容来源于网络,如有侵权,请联系作者删除!