当前位置: 首页>>代码示例>>Java>>正文


Java EntryListener类代码示例

本文整理汇总了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);
                }
            }
        }
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:17,代码来源:ClusterListener.java

示例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);
        }
    }
}
 
开发者ID:mdogan,项目名称:hazelcast-archive,代码行数:22,代码来源:EntryListenerManager.java

示例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);
                }
            }
        }
    }
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:17,代码来源:ClusterListener.java

示例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);
                }
            }
        }
    }
}
 
开发者ID:surevine,项目名称:openfire-bespoke,代码行数:17,代码来源:ClusterListener.java

示例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");
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:HazelcastReplicatedmapConsumerTest.java

示例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");
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:HazelcastMultimapConsumerTest.java

示例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();
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:13,代码来源:SMap.java

示例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();
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:13,代码来源:SMap.java

示例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);
        }
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:11,代码来源:ClusterListener.java

示例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);
}
 
开发者ID:mdogan,项目名称:hazelcast-archive,代码行数:14,代码来源:MultiMapClientProxy.java

示例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));
}
 
开发者ID:mdogan,项目名称:hazelcast-archive,代码行数:16,代码来源:EntryListenerManager.java

示例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);
}
 
开发者ID:mdogan,项目名称:hazelcast-archive,代码行数:14,代码来源:MapClientProxy.java

示例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));
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:7,代码来源:HazelcastReplicatedmapConsumerTest.java

示例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));
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:7,代码来源:HazelcastMultimapConsumerTest.java

示例15: BaseEntryListener

import com.hazelcast.core.EntryListener; //导入依赖的package包/类
public BaseEntryListener(EntryListener<K, V> listener) {
    this.listener = listener;
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:4,代码来源:SMap.java


注:本文中的com.hazelcast.core.EntryListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。