Package org.cometd.oort
Class OortMap.DeltaListener<K,V>
- java.lang.Object
-
- org.cometd.oort.OortMap.DeltaListener<K,V>
-
- Type Parameters:
K- the key typeV- the value type
- All Implemented Interfaces:
java.util.EventListener,OortObject.Listener<java.util.concurrent.ConcurrentMap<K,V>>
public static class OortMap.DeltaListener<K,V> extends java.lang.Object implements OortObject.Listener<java.util.concurrent.ConcurrentMap<K,V>>
An implementation of
OortObject.Listenerthat converts whole map events intoOortMap.EntryListenerevents.For example, if an entity map:
{ key0: value0, key1: value1, key2: value2 }is replaced by a map:
{ key0: value0, key1: valueA, key3: valueB }then this listener generates two "put" events with the following
entries:(key1, value1, valueA) (key3, null, valueB)
and one "remove" event with the following
entry:(key2, value2, null)
Note that no event is emitted for
key0; the values forkey0of the two maps are tested viaObject.equals(Object)and if they are equal no event is generated.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.cometd.oort.OortObject.Listener
OortObject.Listener.Adapter<T>
-
-
Constructor Summary
Constructors Constructor Description DeltaListener(OortMap<K,V> oortMap)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonRemoved(OortObject.Info<java.util.concurrent.ConcurrentMap<K,V>> info)Callback method invoked when the object value is removed, for example because the correspondent node has been shut down or crashed.voidonUpdated(OortObject.Info<java.util.concurrent.ConcurrentMap<K,V>> oldInfo, OortObject.Info<java.util.concurrent.ConcurrentMap<K,V>> newInfo)Callback method invoked when the object value is updated.
-
-
-
Method Detail
-
onUpdated
public void onUpdated(OortObject.Info<java.util.concurrent.ConcurrentMap<K,V>> oldInfo, OortObject.Info<java.util.concurrent.ConcurrentMap<K,V>> newInfo)
Description copied from interface:OortObject.ListenerCallback method invoked when the object value is updated.- Specified by:
onUpdatedin interfaceOortObject.Listener<K>- Parameters:
oldInfo- theOortObject.Infobefore the change, may be nullnewInfo- theOortObject.Infoafter the change
-
onRemoved
public void onRemoved(OortObject.Info<java.util.concurrent.ConcurrentMap<K,V>> info)
Description copied from interface:OortObject.ListenerCallback method invoked when the object value is removed, for example because the correspondent node has been shut down or crashed.- Specified by:
onRemovedin interfaceOortObject.Listener<K>- Parameters:
info- theOortObject.Infobefore the removal
-
-