public class CacheEvent<K,V> extends MapEvent<K,V>
Consider a client code calling a remove() method for a cache. Quite naturally it causes a corresponding ENTRY_DELETED event. However, the same event could be as well caused by the client code calling put() forcing an entry eviction. Alternatively, the put() method called by a client code naturally causes either ENTRY_INSERTED or ENTRY_UPDATED event. However, the same event could be as well caused by a client call to a get() method that in turn forces an entry insertion by a cache loader.
Not all cache service types support the dispatching of synthetic events. Synthetic events will only be dispatched by a partitioned cache service and its derivatives, such as a federated cache service, or by near, view, or remote caches that are backed by a cache service that supports the dispatching of synthetic events. In all other cases, no event will be dispatched for synthetic events such as expiry.
Modifier and Type | Class and Description |
---|---|
static class |
CacheEvent.TransformationState
TransformationState describes how a CacheEvent has been or should be
transformed . |
Modifier and Type | Field and Description |
---|---|
protected static int |
EXPIRED
Flag indicating whether the deletion event is a result of time expiration.
|
protected int |
m_nFlags
Flags holder for event details such as whether the event is synthetic
|
protected CacheEvent.TransformationState |
m_transformState
The transformation state for this event.
|
protected static int |
PRIMING
Flag indicating whether or not the event is a priming event (NearCache).
|
protected static int |
SYNTHETIC
Flag indicating whether or not the event is synthetic.
|
ENTRY_DELETED, ENTRY_INSERTED, ENTRY_UPDATED, m_nId, m_oKey, m_oValueNew, m_oValueOld
source
Constructor and Description |
---|
CacheEvent(ObservableMap<K,V> map,
int nId,
K oKey,
V oValueOld,
V oValueNew,
boolean fSynthetic)
Constructs a new CacheEvent.
|
CacheEvent(ObservableMap<K,V> map,
int nId,
K oKey,
V oValueOld,
V oValueNew,
boolean fSynthetic,
boolean fPriming)
Constructs a new CacheEvent.
|
CacheEvent(ObservableMap<K,V> map,
int nId,
K oKey,
V oValueOld,
V oValueNew,
boolean fSynthetic,
CacheEvent.TransformationState transformState)
Constructs a new CacheEvent.
|
CacheEvent(ObservableMap<K,V> map,
int nId,
K oKey,
V oValueOld,
V oValueNew,
boolean fSynthetic,
CacheEvent.TransformationState transformState,
boolean fPriming)
Constructs a new CacheEvent.
|
CacheEvent(ObservableMap<K,V> map,
int nId,
K oKey,
V oValueOld,
V oValueNew,
boolean fSynthetic,
CacheEvent.TransformationState transformState,
boolean fPriming,
boolean fExpired)
Constructs a new CacheEvent.
|
Modifier and Type | Method and Description |
---|---|
protected String |
getDescription()
Get the event's description.
|
CacheEvent.TransformationState |
getTransformationState()
Return true iff this event is
transformable . |
boolean |
isExpired()
Return true iff this event is caused by an entry eviction due to time limit reached.
|
boolean |
isPriming()
Return true iff this event is caused by a priming listener registration.
|
boolean |
isSynthetic()
Return true iff this event is caused by the cache internal processing
such as eviction or loading
|
protected boolean |
shouldDispatch(MapListener listener)
Return true if the provided
MapListener should receive this
event. |
dispatch, dispatch, dispatch, getDescription, getId, getKey, getMap, getNewEntry, getNewValue, getOldEntry, getOldValue, isDelete, isInsert, isUpdate, readExternal, toString, writeExternal
getSource
protected int m_nFlags
protected CacheEvent.TransformationState m_transformState
protected static final int SYNTHETIC
protected static final int PRIMING
protected static final int EXPIRED
public CacheEvent(ObservableMap<K,V> map, int nId, K oKey, V oValueOld, V oValueNew, boolean fSynthetic)
map
- the ObservableMap object that fired the eventnId
- this event's id, one of MapEvent.ENTRY_INSERTED
,
MapEvent.ENTRY_UPDATED
or MapEvent.ENTRY_DELETED
oKey
- the key into the mapoValueOld
- the old value (for update and delete events)oValueNew
- the new value (for insert and update events)fSynthetic
- true iff the event is caused by the cache
internal processing such as eviction or loadingpublic CacheEvent(ObservableMap<K,V> map, int nId, K oKey, V oValueOld, V oValueNew, boolean fSynthetic, boolean fPriming)
map
- the ObservableMap object that fired the eventnId
- this event's id, one of MapEvent.ENTRY_INSERTED
,
MapEvent.ENTRY_UPDATED
or MapEvent.ENTRY_DELETED
oKey
- the key into the mapoValueOld
- the old value (for update and delete events)oValueNew
- the new value (for insert and update events)fSynthetic
- true iff the event is caused by the cache
internal processing such as eviction or loadingfPriming
- a flag indicating whether or not the event is a priming eventpublic CacheEvent(ObservableMap<K,V> map, int nId, K oKey, V oValueOld, V oValueNew, boolean fSynthetic, CacheEvent.TransformationState transformState)
map
- the ObservableMap object that fired the eventnId
- this event's id, one of MapEvent.ENTRY_INSERTED
,
MapEvent.ENTRY_UPDATED
or MapEvent.ENTRY_DELETED
oKey
- the key into the mapoValueOld
- the old value (for update and delete events)oValueNew
- the new value (for insert and update events)fSynthetic
- true iff the event is caused by the cache
internal processing such as eviction or loadingtransformState
- the state
describing how
this event has been or should be transformedpublic CacheEvent(ObservableMap<K,V> map, int nId, K oKey, V oValueOld, V oValueNew, boolean fSynthetic, CacheEvent.TransformationState transformState, boolean fPriming)
map
- the ObservableMap object that fired the eventnId
- this event's id, one of MapEvent.ENTRY_INSERTED
,
MapEvent.ENTRY_UPDATED
or MapEvent.ENTRY_DELETED
oKey
- the key into the mapoValueOld
- the old value (for update and delete events)oValueNew
- the new value (for insert and update events)fSynthetic
- true iff the event is caused by the cache
internal processing such as eviction or loadingtransformState
- the state
describing how
this event has been or should be transformedfPriming
- a flag indicating whether or not the event is a priming eventpublic CacheEvent(ObservableMap<K,V> map, int nId, K oKey, V oValueOld, V oValueNew, boolean fSynthetic, CacheEvent.TransformationState transformState, boolean fPriming, boolean fExpired)
map
- the ObservableMap object that fired the eventnId
- this event's id, one of MapEvent.ENTRY_INSERTED
,
MapEvent.ENTRY_UPDATED
or MapEvent.ENTRY_DELETED
oKey
- the key into the mapoValueOld
- the old value (for update and delete events)oValueNew
- the new value (for insert and update events)fSynthetic
- true iff the event is caused by the cache
internal processing such as eviction or loadingtransformState
- the state
describing how
this event has been or should be transformedfPriming
- a flag indicating whether or not the event is a priming eventfExpired
- true iff the event results from an eviction due to timeprotected boolean shouldDispatch(MapListener listener)
MapEvent
MapListener
should receive this
event.shouldDispatch
in class MapEvent<K,V>
listener
- the MapListener to dispatch this event topublic boolean isSynthetic()
public boolean isExpired()
isSynthetic()
)public boolean isPriming()
public CacheEvent.TransformationState getTransformationState()
transformable
.
Non-transformable events will not be delivered to MapEventTransformer
listeners.protected String getDescription()
getDescription
in class MapEvent<K,V>