Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


com.tangosol.net.cache
Class CacheEvent

java.lang.Object
  extended by java.util.EventObject
      extended by com.tangosol.util.MapEvent
          extended by com.tangosol.net.cache.CacheEvent

All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AbstractKeyBasedMap.DeferredCacheEvent, ConverterCollections.ConverterMapEvent, MapListenerSupport.FilterEvent, OverflowMap.HistoricCacheEvent

public class CacheEvent
extends MapEvent

An extension of the MapEvent which allows to differentiate between client driven (natural) events and cache internal (synthetic) events.

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.

Since:
Coherence 2.3
Author:
gg 2003.09.12

Nested Class Summary
static class CacheEvent.TransformationState
          TransformationState describes how a CacheEvent has been or should be transformed.

 

Field Summary
protected  boolean m_fSynthetic
          Flag indicating whether or not the event is synthetic.
protected  CacheEvent.TransformationState m_transformState
          The transformation state for this event.

 

Fields inherited from class com.tangosol.util.MapEvent
ENTRY_DELETED, ENTRY_INSERTED, ENTRY_UPDATED, m_nId, m_oKey, m_oValueNew, m_oValueOld

 

Fields inherited from class java.util.EventObject
source

 

Constructor Summary
CacheEvent(ObservableMap map, int nId, java.lang.Object oKey, java.lang.Object oValueOld, java.lang.Object oValueNew, boolean fSynthetic)
          Constructs a new CacheEvent.
CacheEvent(ObservableMap map, int nId, java.lang.Object oKey, java.lang.Object oValueOld, java.lang.Object oValueNew, boolean fSynthetic, CacheEvent.TransformationState transformState)
          Constructs a new CacheEvent.

 

Method Summary
protected  java.lang.String getDescription()
          Get the event's description.
 CacheEvent.TransformationState getTransformationState()
          Return true iff this event is transformable.
 boolean isSynthetic()
          Return true iff this event is caused by the cache internal processing such as eviction or loading

 

Methods inherited from class com.tangosol.util.MapEvent
dispatch, dispatch, dispatch, getDescription, getId, getKey, getMap, getNewEntry, getNewValue, getOldEntry, getOldValue, toString

 

Methods inherited from class java.util.EventObject
getSource

 

Field Detail

m_fSynthetic

protected boolean m_fSynthetic
Flag indicating whether or not the event is synthetic.

m_transformState

protected CacheEvent.TransformationState m_transformState
The transformation state for this event.

Constructor Detail

CacheEvent

public CacheEvent(ObservableMap map,
                  int nId,
                  java.lang.Object oKey,
                  java.lang.Object oValueOld,
                  java.lang.Object 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_UPDATED or 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

CacheEvent

public CacheEvent(ObservableMap map,
                  int nId,
                  java.lang.Object oKey,
                  java.lang.Object oValueOld,
                  java.lang.Object 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_UPDATED or 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 state describing how this event has been or should be transformed

Method Detail

isSynthetic

public 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

getTransformationState

public CacheEvent.TransformationState getTransformationState()
Return true iff this event is transformable. Non-transformable events will not be delivered to MapEventTransformer listeners.
Returns:
true iff this event is transformable

getDescription

protected java.lang.String getDescription()
Get the event's description.
Overrides:
getDescription in class MapEvent
Returns:
this event's description

Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.