本文整理汇总了Java中org.infinispan.Cache.getListeners方法的典型用法代码示例。如果您正苦于以下问题:Java Cache.getListeners方法的具体用法?Java Cache.getListeners怎么用?Java Cache.getListeners使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.infinispan.Cache
的用法示例。
在下文中一共展示了Cache.getListeners方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getListeners
import org.infinispan.Cache; //导入方法依赖的package包/类
@Override
public Set<IGetUpdates<?, ?>> getListeners(String containerName,
String cacheName) {
EmbeddedCacheManager manager = this.cm;
Cache<Object,Object> c;
String realCacheName = "{" + containerName + "}_{" + cacheName + "}";
if (manager == null) {
return null;
}
if (!manager.cacheExists(realCacheName)) {
return null;
}
c = manager.getCache(realCacheName);
Set<IGetUpdates<?, ?>> res = new HashSet<IGetUpdates<?, ?>>();
Set<Object> listeners = c.getListeners();
for (Object listener : listeners) {
if (listener instanceof CacheListenerContainer) {
CacheListenerContainer cl = (CacheListenerContainer) listener;
res.add(cl.whichListener());
}
}
return res;
}
示例2: removeListener
import org.infinispan.Cache; //导入方法依赖的package包/类
@Override
public void removeListener(String containerName, String cacheName,
IGetUpdates<?, ?> u) {
EmbeddedCacheManager manager = this.cm;
Cache<Object,Object> c;
String realCacheName = "{" + containerName + "}_{" + cacheName + "}";
if (manager == null) {
return;
}
if (!manager.cacheExists(realCacheName)) {
return;
}
c = manager.getCache(realCacheName);
Set<Object> listeners = c.getListeners();
for (Object listener : listeners) {
if (listener instanceof CacheListenerContainer) {
CacheListenerContainer cl = (CacheListenerContainer) listener;
if (cl.whichListener() == u) {
c.removeListener(listener);
return;
}
}
}
}