Class CacheEvent<K,V> 
- All Implemented Interfaces:
- PortableObject,- CollectionEvent<V>,- Serializable
- Direct Known Subclasses:
- AbstractKeyBasedMap.DeferredCacheEvent,- ConverterCollections.ConverterMapEvent,- MapListenerSupport.FilterEvent,- OverflowMap.HistoricCacheEvent
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.
- Since:
- Coherence 2.3
- Author:
- gg 2003.09.12
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumTransformationState describes how a CacheEvent has been or should betransformed.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected static final intFlag indicating whether the deletion event is a result of time expiration.protected intFlags holder for event details such as whether the event is syntheticprotected CacheEvent.TransformationStateThe transformation state for this event.protected static final intFlag indicating whether or not the event is a priming event (NearCache).protected static final intFlag indicating whether or not the event is synthetic.Fields inherited from class com.tangosol.util.MapEventENTRY_DELETED, ENTRY_INSERTED, ENTRY_UPDATED, m_key, m_nId, m_nPartition, m_nVersion, m_valueNew, m_valueOldFields inherited from class java.util.EventObjectsource
- 
Constructor SummaryConstructorsConstructorDescriptionCacheEvent(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.
- 
Method SummaryModifier and TypeMethodDescriptionprotected StringGet the event's description.Return true iff this event istransformable.booleanReturn true iff this event is caused by an entry eviction due to time limit reached.booleanReturn true iff this event is caused by a priming listener registration.booleanReturn true iff this event is caused by the cache internal processing such as eviction or loadingbooleanReturn true iff this event is caused by a synthetic version update sent by the server to notify clients of the current version.protected booleanshouldDispatch(MapListener listener) Return true if the providedMapListenershould receive this event.CacheEvent<K, V> with(int nPartition, long lVersion) Return a MapEvent that is enriched with the provided partition and version.Methods inherited from class com.tangosol.util.MapEventdispatch, dispatch, dispatch, getDescription, getId, getKey, getMap, getNewEntry, getNewValue, getOldEntry, getOldValue, getPartition, getVersion, isDelete, isInsert, isUpdate, readExternal, toString, writeExternalMethods inherited from class java.util.EventObjectgetSource
- 
Field Details- 
m_nFlagsprotected int m_nFlagsFlags holder for event details such as whether the event is synthetic
- 
m_transformStateThe transformation state for this event.
- 
SYNTHETICprotected static final int SYNTHETICFlag indicating whether or not the event is synthetic.- See Also:
 
- 
PRIMINGprotected static final int PRIMINGFlag indicating whether or not the event is a priming event (NearCache).- See Also:
 
- 
EXPIREDprotected static final int EXPIREDFlag indicating whether the deletion event is a result of time expiration.- See Also:
 
 
- 
- 
Constructor Details- 
CacheEventpublic CacheEvent(ObservableMap<K, V> map, int nId, K oKey, V oValueOld, V oValueNew, boolean fSynthetic) Constructs a new CacheEvent.- Parameters:
- map- the ObservableMap object that fired the event
- nId- this event's id, one of- MapEvent.ENTRY_INSERTED,- MapEvent.ENTRY_UPDATEDor- MapEvent.ENTRY_DELETED
- oKey- the key into the map
- oValueOld- 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 loading
 
- 
CacheEventpublic CacheEvent(ObservableMap<K, V> map, int nId, K oKey, V oValueOld, V oValueNew, boolean fSynthetic, boolean fPriming) Constructs a new CacheEvent.- Parameters:
- map- the ObservableMap object that fired the event
- nId- this event's id, one of- MapEvent.ENTRY_INSERTED,- MapEvent.ENTRY_UPDATEDor- MapEvent.ENTRY_DELETED
- oKey- the key into the map
- oValueOld- 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 loading
- fPriming- a flag indicating whether or not the event is a priming event
 
- 
CacheEventpublic CacheEvent(ObservableMap<K, V> map, int nId, K oKey, V oValueOld, V oValueNew, boolean fSynthetic, CacheEvent.TransformationState transformState) Constructs a new CacheEvent.- Parameters:
- map- the ObservableMap object that fired the event
- nId- this event's id, one of- MapEvent.ENTRY_INSERTED,- MapEvent.ENTRY_UPDATEDor- MapEvent.ENTRY_DELETED
- oKey- the key into the map
- oValueOld- 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 loading
- transformState- the- statedescribing how this event has been or should be transformed
 
- 
CacheEventpublic CacheEvent(ObservableMap<K, V> map, int nId, K oKey, V oValueOld, V oValueNew, boolean fSynthetic, CacheEvent.TransformationState transformState, boolean fPriming) Constructs a new CacheEvent.- Parameters:
- map- the ObservableMap object that fired the event
- nId- this event's id, one of- MapEvent.ENTRY_INSERTED,- MapEvent.ENTRY_UPDATEDor- MapEvent.ENTRY_DELETED
- oKey- the key into the map
- oValueOld- 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 loading
- transformState- the- statedescribing how this event has been or should be transformed
- fPriming- a flag indicating whether or not the event is a priming event
 
- 
CacheEventpublic 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.- Parameters:
- map- the ObservableMap object that fired the event
- nId- this event's id, one of- MapEvent.ENTRY_INSERTED,- MapEvent.ENTRY_UPDATEDor- MapEvent.ENTRY_DELETED
- oKey- the key into the map
- oValueOld- 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 loading
- transformState- the- statedescribing how this event has been or should be transformed
- fPriming- a flag indicating whether or not the event is a priming event
- fExpired- true iff the event results from an eviction due to time
- Since:
- 22.06
 
 
- 
- 
Method Details- 
withDescription copied from class:MapEventReturn a MapEvent that is enriched with the provided partition and version.
- 
shouldDispatchDescription copied from class:MapEventReturn true if the providedMapListenershould receive this event.- Overrides:
- shouldDispatchin class- MapEvent<K,- V> 
- Parameters:
- listener- the MapListener to dispatch this event to
- Returns:
- true if the provided MapListener should receive the event
 
- 
isSyntheticpublic boolean isSynthetic()Return true iff this event is caused by the cache internal processing such as eviction or loading- Returns:
- true iff this event is caused by the cache internal processing
 
- 
isExpiredpublic boolean isExpired()Return true iff this event is caused by an entry eviction due to time limit reached. In this case the event will also be synthetic (seeisSynthetic())- Returns:
- true iff this event results from a timed eviction
- Since:
- 22.06
 
- 
isPrimingpublic boolean isPriming()Return true iff this event is caused by a priming listener registration.- Returns:
- true iff this event is caused by a priming listener registration
 
- 
isVersionUpdatepublic boolean isVersionUpdate()Return true iff this event is caused by a synthetic version update sent by the server to notify clients of the current version.- Returns:
- true iff this event is caused by a synthetic version update
 
- 
getTransformationStateReturn true iff this event istransformable. Non-transformable events will not be delivered to MapEventTransformer listeners.- Returns:
- true iff this event is transformable
 
- 
getDescriptionGet the event's description.- Overrides:
- getDescriptionin class- MapEvent<K,- V> 
- Returns:
- this event's description
 
 
-