K
- the type of the Map entry keysV
- the type of the Map entry valuespublic interface ObservableMap<K,V> extends Map<K,V>
This is primarily intended for maps that have automatic pruning and purging strategies or maps that are asynchronously modified by different threads.
Starting from Coherence 2.3 it supports optimizations that optionally do not require the map values to be included in the map events, allowing a "lite" event to be delivered and saving memory, processing and bandwidth for distributed applications.
NamedCache
, LocalCache
, ObservableHashMap
Modifier and Type | Method and Description |
---|---|
void |
addMapListener(MapListener<? super K,? super V> listener)
Add a standard map listener that will receive all events (inserts, updates, deletes) that occur against the map, with the key, old-value and new-value included.
|
void |
addMapListener(MapListener<? super K,? super V> listener, Filter filter, boolean fLite)
Add a map listener that receives events based on a filter evaluation.
|
void |
addMapListener(MapListener<? super K,? super V> listener, K key, boolean fLite)
Add a map listener for a specific key.
|
void |
removeMapListener(MapListener<? super K,? super V> listener)
Remove a standard map listener that previously signed up for all events.
|
void |
removeMapListener(MapListener<? super K,? super V> listener, Filter filter)
Remove a map listener that previously signed up for events based on a filter evaluation.
|
void |
removeMapListener(MapListener<? super K,? super V> listener, K key)
Remove a map listener that previously signed up for events about a specific key.
|
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
void addMapListener(MapListener<? super K,? super V> listener)
addMapListener(listener, (Filter) null, false);
listener
- the MapEvent
listener to addvoid removeMapListener(MapListener<? super K,? super V> listener)
removeMapListener(listener, (Filter) null);
listener
- the listener to removevoid addMapListener(MapListener<? super K,? super V> listener, K key, boolean fLite)
The listeners will receive MapEvent objects, but if fLite is passed as true, they might not contain the OldValue and NewValue properties.
To unregister the MapListener, use the removeMapListener(MapListener, Object)
method.
void removeMapListener(MapListener<? super K,? super V> listener, K key)
listener
- the listener to removekey
- the key that identifies the entry for which to raise eventsvoid addMapListener(MapListener<? super K,? super V> listener, Filter filter, boolean fLite)
The listeners will receive MapEvent objects, but if fLite is passed as true, they might not contain the OldValue and NewValue properties.
To unregister the MapListener, use the removeMapListener(MapListener, Filter)
method.
listener
- the MapEvent
listener to addfilter
- a filter that will be passed MapEvent objects to select from; a MapEvent will be delivered to the listener only if the filter evaluates to true for that MapEvent (see MapEventFilter
); null is equivalent to a filter that alway returns truefLite
- true to indicate that the MapEvent
objects do not have to include the OldValue and NewValue property values in order to allow optimizationsvoid removeMapListener(MapListener<? super K,? super V> listener, Filter filter)
listener
- the listener to removefilter
- the filter that was passed into the corresponding addMapListener() call