本文整理汇总了Java中com.hazelcast.core.EntryListener类的典型用法代码示例。如果您正苦于以下问题:Java EntryListener类的具体用法?Java EntryListener怎么用?Java EntryListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EntryListener类属于com.hazelcast.core包,在下文中一共展示了EntryListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: simulateCacheInserts
import com.hazelcast.core.EntryListener; //导入依赖的package包/类
private void simulateCacheInserts(Cache cache) {
EntryListener EntryListener = EntryListeners.get(cache);
if (EntryListener != null) {
if (cache instanceof CacheWrapper) {
Cache wrapped = ((CacheWrapper) cache).getWrappedCache();
if (wrapped instanceof ClusteredCache) {
ClusteredCache clusteredCache = (ClusteredCache) wrapped;
for (Map.Entry entry : (Set<Map.Entry>) cache.entrySet()) {
EntryEvent event = new EntryEvent(clusteredCache.map.getName(), cluster.getLocalMember(),
EntryEventType.ADDED.getType(), entry.getKey(), null, entry.getValue());
EntryListener.entryAdded(event);
}
}
}
}
}
示例2: removeListener
import com.hazelcast.core.EntryListener; //导入依赖的package包/类
public synchronized void removeListener(String name, Object key, EntryListener<?, ?> entryListener) {
Map<Object, List<EntryListenerHolder>> m = entryListeners.get(name);
if (m != null) {
key = toKey(key);
List<EntryListenerHolder> list = m.get(key);
if (list != null) {
for (final Iterator<EntryListenerHolder> it = list.iterator(); it.hasNext(); ) {
final EntryListenerHolder entryListenerHolder = it.next();
if (entryListenerHolder.listener.equals(entryListener)) {
list.remove(entryListenerHolder);
}
}
if (m.get(key).isEmpty()) {
m.remove(key);
}
}
if (m.isEmpty()) {
entryListeners.remove(name);
}
}
}
示例3: simulateCacheInserts
import com.hazelcast.core.EntryListener; //导入依赖的package包/类
private void simulateCacheInserts(Cache cache) {
EntryListener EntryListener = EntryListeners.get(cache);
if (EntryListener != null) {
if (cache instanceof CacheWrapper) {
Cache wrapped = ((CacheWrapper) cache).getWrappedCache();
if (wrapped instanceof ClusteredCache) {
ClusteredCache clusteredCache = (ClusteredCache) wrapped;
for (Map.Entry entry : (Set<Map.Entry>) cache.entrySet()) {
EntryEvent event = new EntryEvent(clusteredCache.map.getName(), cluster.getLocalMember(),
EntryEventType.ADDED.getType(), entry.getKey(), null, entry.getValue());
EntryListener.entryAdded(event);
}
}
}
}
}
示例4: simulateCacheInserts
import com.hazelcast.core.EntryListener; //导入依赖的package包/类
private void simulateCacheInserts(Cache cache) {
EntryListener EntryListener = EntryListeners.get(cache);
if (EntryListener != null) {
if (cache instanceof CacheWrapper) {
Cache wrapped = ((CacheWrapper) cache).getWrappedCache();
if (wrapped instanceof ClusteredCache) {
ClusteredCache clusteredCache = (ClusteredCache) wrapped;
for (Map.Entry entry : (Set<Map.Entry>) cache.entrySet()) {
EntryEvent event = new EntryEvent(clusteredCache.map.getName(), cluster.getLocalMember(),
EntryEvent.TYPE_ADDED, entry.getKey(), null, entry.getValue());
EntryListener.entryAdded(event);
}
}
}
}
}
示例5: trainHazelcastInstance
import com.hazelcast.core.EntryListener; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected void trainHazelcastInstance(HazelcastInstance hazelcastInstance) {
when(hazelcastInstance.getReplicatedMap("rm")).thenReturn(map);
argument = ArgumentCaptor.forClass(EntryListener.class);
when(map.addEntryListener(argument.capture(), eq(true))).thenReturn("foo");
}
示例6: trainHazelcastInstance
import com.hazelcast.core.EntryListener; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected void trainHazelcastInstance(HazelcastInstance hazelcastInstance) {
when(hazelcastInstance.getMultiMap("mm")).thenReturn(map);
argument = ArgumentCaptor.forClass(EntryListener.class);
when(map.addEntryListener(argument.capture(), eq(true))).thenReturn("foo");
}
示例7: addLocalEntryListener
import com.hazelcast.core.EntryListener; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @deprecated not implemented yet
* @throws UnsupportedOperationException not implemented yet
*/
@Deprecated
@Override
public String addLocalEntryListener(EntryListener<K, V> listener,
Predicate<K, V> predicate, boolean includeValue) {
throw new UnsupportedOperationException();
}
示例8: addEntryListener
import com.hazelcast.core.EntryListener; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @deprecated not implemented yet
* @throws UnsupportedOperationException not implemented yet
*/
@Deprecated
@Override
public String addEntryListener(EntryListener<K, V> listener,
Predicate<K, V> predicate, boolean includeValue) {
throw new UnsupportedOperationException();
}
示例9: addEntryListener
import com.hazelcast.core.EntryListener; //导入依赖的package包/类
private void addEntryListener(Cache cache, EntryListener listener) {
if (cache instanceof CacheWrapper) {
Cache wrapped = ((CacheWrapper)cache).getWrappedCache();
if (wrapped instanceof ClusteredCache) {
((ClusteredCache)wrapped).addEntryListener(listener, false);
// Keep track of the listener that we added to the cache
EntryListeners.put(cache, listener);
}
}
}
示例10: addEntryListener
import com.hazelcast.core.EntryListener; //导入依赖的package包/类
public void addEntryListener(EntryListener<K, V> listener, K key, boolean includeValue) {
check(listener);
Boolean noEntryListenerRegistered = entryListenerManager().noListenerRegistered(key, name, includeValue);
if (noEntryListenerRegistered == null) {
proxyHelper.doOp(ClusterOperation.REMOVE_LISTENER, key, null);
noEntryListenerRegistered = Boolean.TRUE;
}
if (noEntryListenerRegistered.booleanValue()) {
Call c = entryListenerManager().createNewAddListenerCall(proxyHelper, key, includeValue);
proxyHelper.doCall(c);
}
entryListenerManager().registerListener(name, key, includeValue, listener);
}
示例11: registerListener
import com.hazelcast.core.EntryListener; //导入依赖的package包/类
public synchronized void registerListener(String name, Object key, boolean includeValue, EntryListener<?, ?> entryListener) {
ConcurrentHashMap<Object, List<EntryListenerHolder>> map = entryListeners.get(name);
key = toKey(key);
if (map == null) {
map = new ConcurrentHashMap<Object, List<EntryListenerHolder>>();
final ConcurrentHashMap<Object, List<EntryListenerHolder>> map2 = entryListeners.putIfAbsent(name, map);
if (map2 != null) {
map = map2;
}
}
if (!map.contains(key)) {
map.putIfAbsent(key, new CopyOnWriteArrayList<EntryListenerHolder>());
}
map.get(key).add(new EntryListenerHolder(entryListener, includeValue));
}
示例12: addEntryListener
import com.hazelcast.core.EntryListener; //导入依赖的package包/类
public void addEntryListener(EntryListener<K, V> listener, K key, boolean includeValue) {
check(listener);
Boolean noEntryListenerRegistered = listenerManager().noListenerRegistered(key, name, includeValue);
if (noEntryListenerRegistered == null) {
proxyHelper.doOp(ClusterOperation.REMOVE_LISTENER, key, null);
noEntryListenerRegistered = Boolean.TRUE;
}
if (noEntryListenerRegistered) {
Call c = listenerManager().createNewAddListenerCall(proxyHelper, key, includeValue);
proxyHelper.doCall(c);
}
listenerManager().registerListener(name, key, includeValue, listener);
}
示例13: verifyHazelcastInstance
import com.hazelcast.core.EntryListener; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected void verifyHazelcastInstance(HazelcastInstance hazelcastInstance) {
verify(hazelcastInstance).getReplicatedMap("rm");
verify(map).addEntryListener(any(EntryListener.class), eq(true));
}
示例14: verifyHazelcastInstance
import com.hazelcast.core.EntryListener; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected void verifyHazelcastInstance(HazelcastInstance hazelcastInstance) {
verify(hazelcastInstance).getMultiMap("mm");
verify(map).addEntryListener(any(EntryListener.class), eq(true));
}
示例15: BaseEntryListener
import com.hazelcast.core.EntryListener; //导入依赖的package包/类
public BaseEntryListener(EntryListener<K, V> listener) {
this.listener = listener;
}