Search in sources :

Example 1 with MapListener

use of com.tangosol.util.MapListener in project Openfire by igniterealtime.

the class ClusterListener method simuateCacheInserts.

private void simuateCacheInserts(Cache<Object, Object> cache) {
    MapListener mapListener = mapListeners.get(cache);
    if (mapListener != null) {
        if (cache instanceof CacheWrapper) {
            Cache wrapped = ((CacheWrapper) cache).getWrappedCache();
            if (wrapped instanceof ClusteredCache) {
                ClusteredCache clusteredCache = (ClusteredCache) wrapped;
                for (Map.Entry entry : cache.entrySet()) {
                    MapEvent event = new MapEvent(clusteredCache.map, MapEvent.ENTRY_INSERTED, entry.getKey(), null, entry.getValue());
                    mapListener.entryInserted(event);
                }
            }
        }
    }
}
Also used : CacheWrapper(org.jivesoftware.util.cache.CacheWrapper) MapListener(com.tangosol.util.MapListener) MapEvent(com.tangosol.util.MapEvent) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Cache(org.jivesoftware.util.cache.Cache)

Aggregations

MapEvent (com.tangosol.util.MapEvent)1 MapListener (com.tangosol.util.MapListener)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Cache (org.jivesoftware.util.cache.Cache)1 CacheWrapper (org.jivesoftware.util.cache.CacheWrapper)1