Package org.jivesoftware.util.cache
Class ReverseLookupUpdatingCacheEntryListener<K,V>
- java.lang.Object
-
- org.jivesoftware.util.cache.ReverseLookupUpdatingCacheEntryListener<K,V>
-
- All Implemented Interfaces:
ClusteredCacheEntryListener<K,V>
public class ReverseLookupUpdatingCacheEntryListener<K,V> extends Object implements ClusteredCacheEntryListener<K,V>
Cache entry listener implementation that maintains a reverse lookup map for the cache that is being observed, which is used to identify what cluster node is the logical owner of a particular cache entry. This information is typically useful in scenarios where a cluster node drops out of the cluster requiring the remaining nodes to have to inform their connected entities of what resources have become unavailable. This implementation assumes that the cluster node on which the cache entry change originates is the owner of the corresponding entry (cache entry updates are ignored).
-
-
Constructor Summary
Constructors Constructor Description ReverseLookupUpdatingCacheEntryListener(ConcurrentMap<NodeID,Set<K>> reverseCacheRepresentation)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
entryAdded(K key, V value, NodeID nodeID)
An entry was added to the cache.void
entryEvicted(K key, V oldValue, NodeID nodeID)
An entry was evicted from the cache.void
entryRemoved(K key, V oldValue, NodeID nodeID)
An entry was removed from the cache.void
entryUpdated(K key, V oldValue, V newValue, NodeID nodeID)
An entry was updated in the cache.void
mapCleared(NodeID nodeID)
The cache was cleared.void
mapEvicted(NodeID nodeID)
The cache was evicted.
-
-
-
Constructor Detail
-
ReverseLookupUpdatingCacheEntryListener
public ReverseLookupUpdatingCacheEntryListener(@Nonnull ConcurrentMap<NodeID,Set<K>> reverseCacheRepresentation)
-
-
Method Detail
-
entryAdded
public void entryAdded(@Nonnull K key, @Nullable V value, @Nonnull NodeID nodeID)
Description copied from interface:ClusteredCacheEntryListener
An entry was added to the cache.- Specified by:
entryAdded
in interfaceClusteredCacheEntryListener<K,V>
- Parameters:
key
- The key of the entry that was added.value
- The (optional) value of the entry that was added.nodeID
- identifier of the node on which the cache modification occurred.
-
entryRemoved
public void entryRemoved(@Nonnull K key, @Nullable V oldValue, @Nonnull NodeID nodeID)
Description copied from interface:ClusteredCacheEntryListener
An entry was removed from the cache.- Specified by:
entryRemoved
in interfaceClusteredCacheEntryListener<K,V>
- Parameters:
key
- The key of the entry that was removed.oldValue
- The (optional) value of the entry that was removed.nodeID
- identifier of the node on which the cache modification occurred.
-
entryUpdated
public void entryUpdated(@Nonnull K key, @Nullable V oldValue, @Nullable V newValue, @Nonnull NodeID nodeID)
Description copied from interface:ClusteredCacheEntryListener
An entry was updated in the cache.- Specified by:
entryUpdated
in interfaceClusteredCacheEntryListener<K,V>
- Parameters:
key
- The key of the entry that was changed.oldValue
- The (optional) value of the entry prior to the update.newValue
- The (optional) value of the entry after to the update.nodeID
- identifier of the node on which the cache modification occurred.
-
entryEvicted
public void entryEvicted(@Nonnull K key, @Nullable V oldValue, @Nonnull NodeID nodeID)
Description copied from interface:ClusteredCacheEntryListener
An entry was evicted from the cache.- Specified by:
entryEvicted
in interfaceClusteredCacheEntryListener<K,V>
- Parameters:
key
- The key of the entry that was evicted.oldValue
- The (optional) value of the entry that was removed.nodeID
- identifier of the node on which the cache modification occurred.
-
mapCleared
public void mapCleared(@Nonnull NodeID nodeID)
Description copied from interface:ClusteredCacheEntryListener
The cache was cleared.- Specified by:
mapCleared
in interfaceClusteredCacheEntryListener<K,V>
- Parameters:
nodeID
- identifier of the node on which the cache modification occurred.
-
mapEvicted
public void mapEvicted(@Nonnull NodeID nodeID)
Description copied from interface:ClusteredCacheEntryListener
The cache was evicted.- Specified by:
mapEvicted
in interfaceClusteredCacheEntryListener<K,V>
- Parameters:
nodeID
- identifier of the node on which the cache modification occurred.
-
-