本文整理了Java中org.infinispan.Cache.removeListener()
方法的一些代码示例,展示了Cache.removeListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cache.removeListener()
方法的具体详情如下:
包路径:org.infinispan.Cache
类名称:Cache
方法名:removeListener
暂无
代码示例来源:origin: wildfly/wildfly
@Override
public void close() {
this.cache.removeListener(this);
}
代码示例来源:origin: wildfly/wildfly
@Override
public void stop() {
this.expirationRegistration.close();
this.cache.removeListener(this);
this.cache.removeListener(this.factory.getMetaDataFactory());
this.cache.removeListener(this.factory.getAttributesFactory());
this.identifierFactory.stop();
}
代码示例来源:origin: wildfly/wildfly
@Override
public void close() {
this.cache.removeListener(this);
this.cache.getCacheManager().removeListener(this);
// Cleanup any unregistered listeners
for (ExecutorService executor : this.listeners.values()) {
PrivilegedAction<List<Runnable>> action = () -> executor.shutdownNow();
WildFlySecurityManager.doUnchecked(action);
}
this.listeners.clear();
}
代码示例来源:origin: wildfly/wildfly
@Override
public void close() {
this.groupRegistration.close();
this.cache.removeListener(this);
this.dispatcher.close();
// Cleanup any unclosed registrations
for (Map.Entry<Listener, ExecutorService> entry : this.listeners.values()) {
ExecutorService executor = entry.getValue();
if (executor != null) {
PrivilegedAction<List<Runnable>> action = () -> executor.shutdownNow();
WildFlySecurityManager.doUnchecked(action);
}
}
this.listeners.clear();
}
代码示例来源:origin: wildfly/wildfly
@Override
public void close() {
this.cache.removeListener(this);
PrivilegedAction<List<Runnable>> action = () -> this.executor.shutdownNow();
WildFlySecurityManager.doUnchecked(action);
try {
this.executor.awaitTermination(this.cache.getCacheConfiguration().transaction().cacheStopTimeout(), TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
this.dispatcher.close();
this.scheduler.close();
}
代码示例来源:origin: wildfly/wildfly
@Override
public void stop() {
this.groupFactory.close();
this.cache.removeListener(this);
PrivilegedAction<List<Runnable>> action = () -> this.executor.shutdownNow();
WildFlySecurityManager.doUnchecked(action);
try {
this.executor.awaitTermination(this.cache.getCacheConfiguration().transaction().cacheStopTimeout(), TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} finally {
if (this.dispatcher != null) {
this.dispatcher.close();
}
this.scheduler.close();
this.affinity.stop();
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public void close() {
this.cache.removeListener(this);
this.shutdown(this.topologyChangeExecutor);
try (Batch batch = this.batcher.createBatch()) {
// If this remove fails, the entry will be auto-removed on topology change by the new primary owner
this.cache.getAdvancedCache().withFlags(Flag.IGNORE_RETURN_VALUES, Flag.FAIL_SILENTLY).remove(this.group.getAddress(this.group.getLocalMember()));
} catch (CacheException e) {
ClusteringLogger.ROOT_LOGGER.warn(e.getLocalizedMessage(), e);
} finally {
// Cleanup any unregistered listeners
for (ExecutorService executor : this.listeners.values()) {
this.shutdown(executor);
}
this.listeners.clear();
this.closeTask.run();
}
}
代码示例来源:origin: org.infinispan/infinispan-embedded-query
@Override
public void removeContinuousQueryListener(ContinuousQueryListener<K, ?> listener) {
for (Iterator<EntryListener<K, V, ?>> it = listeners.iterator(); it.hasNext(); ) {
EntryListener<K, V, ?> l = it.next();
if (l.listener == listener) {
cache.removeListener(l);
it.remove();
break;
}
}
}
代码示例来源:origin: org.infinispan/infinispan-query
@Override
public void removeContinuousQueryListener(ContinuousQueryListener<K, ?> listener) {
for (Iterator<EntryListener<K, V, ?>> it = listeners.iterator(); it.hasNext(); ) {
EntryListener<K, V, ?> l = it.next();
if (l.listener == listener) {
cache.removeListener(l);
it.remove();
break;
}
}
}
代码示例来源:origin: org.infinispan/infinispan-server-hotrod
boolean removeClientListener(byte[] listenerId, Cache cache) {
Object sender = eventSenders.get(new WrappedByteArray(listenerId));
if (sender != null) {
cache.removeListener(sender);
return true;
} else return false;
}
代码示例来源:origin: org.jboss.as/jboss-as-clustering-web-infinispan
/**
* {@inheritDoc}
*
* @see org.jboss.as.clustering.web.DistributedCacheManager#stop()
*/
@Override
public void stop() {
this.affinity.stop();
this.cache.removeListener(this);
}
代码示例来源:origin: org.jboss.cluster/jboss-ha-server-cache-ispn
@Override
public void stopService() throws Exception
{
this.cache.removeListener(this);
this.cache.stop();
}
代码示例来源:origin: org.apache.camel/camel-infinispan
@Override
protected void doStop() throws Exception {
this.cache.removeListener(this);
this.cache.remove(lockKey, lockValue);
if (future != null) {
future.cancel(true);
future = null;
}
}
代码示例来源:origin: org.jboss.eap/wildfly-clustering-server
@Override
public void close() {
this.cache.removeListener(this);
this.cache.getCacheManager().removeListener(this);
// Cleanup any unregistered listeners
for (ExecutorService executor : this.listeners.values()) {
PrivilegedAction<List<Runnable>> action = () -> executor.shutdownNow();
WildFlySecurityManager.doUnchecked(action);
}
this.listeners.clear();
}
代码示例来源:origin: org.apache.camel/camel-infinispan
@Override
public void stop(InfinispanConsumer consumer) {
Cache<?, ?> embeddedCache = InfinispanUtil.asEmbedded(consumer.getCache());
embeddedCache.removeListener(consumer.getListener());
}
}
代码示例来源:origin: org.overlord.rtgov.active-queries/active-collection-infinispan
/**
* {@inheritDoc}
*/
protected void finalize() throws Throwable {
super.finalize();
if (_listener != null && getMap() instanceof Cache) {
((Cache<Object, Object>)getMap()).removeListener(_listener);
}
}
代码示例来源:origin: org.infinispan/infinispan-core
private void testSimpleCacheStarting(final StateListener<String, String> listener) {
final Map<String, String> expectedValues = new HashMap<>(10);
Cache<String, String> cache = cache(0, CACHE_NAME);
populateCache(cache, expectedValues);
cache.addListener(listener);
try {
verifyEvents(isClustered(listener), listener, expectedValues);
} finally {
cache.removeListener(listener);
}
}
代码示例来源:origin: org.infinispan/infinispan-core
public void testCallbackValues() throws Exception {
Cache<Object, Object> cache1 = cache(0, "replSync");
cache(1, "replSync");
MockListener l = new MockListener();
cache1.addListener(l);
try {
Pojo pojo = new Pojo();
cache1.put("key", pojo);
assertTrue("received " + l.newValue.getClass().getName(), l.newValue instanceof Pojo);
} finally {
cache1.removeListener(l);
}
}
代码示例来源:origin: org.infinispan/infinispan-core
public void testSyncRepl() throws Exception {
Integer age;
LocalListener lis = new LocalListener();
cache1.addListener(lis);
try {
lis.put("age", 38);
} finally {
cache2.removeListener(lis);
}
// value on cache2 must be 38
age = (Integer) cache2.get("age");
assertNotNull("\"age\" obtained from cache2 must be non-null ", age);
assertTrue("\"age\" must be 38", age == 38);
}
代码示例来源:origin: org.infinispan/infinispan-core
public void testEventFilterCurrentState() {
for (int i = 0; i < NUM_ENTRIES; ++i) {
Cache<Object, String> cache = cache(i % NUM_NODES);
Object key = new MagicKey(cache);
cache.put(key, "string " + i);
}
assertEquals(NUM_ENTRIES, cache(0).size());
EntryListener listener = new EntryListener();
NoOpCacheEventFilterConverterWithDependencies filterConverter = new NoOpCacheEventFilterConverterWithDependencies();
cache(0).addListener(listener, filterConverter, filterConverter);
assertEquals(NUM_ENTRIES, listener.createEvents.size());
cache(0).removeListener(listener);
}
内容来源于网络,如有侵权,请联系作者删除!