public class GridCacheEvent extends GridEventAdapter
Grid events are used for notification about what happens within the grid. Note that by design GridGain keeps all events generated on the local node locally and it provides APIs for performing a distributed queries across multiple nodes:
GridEvents.remoteQuery(GridPredicate, long) -
asynchronously querying events occurred on the nodes specified, including remote nodes.
GridEvents.localQuery(GridPredicate) -
querying only local events stored on this local node.
GridEvents.localListen(GridPredicate, int...) -
listening to local grid events (events from remote nodes not included).
GridEvents.waitForLocal(GridPredicate, int...).
It is highly recommended to enable only those events that your application logic requires
by using GridConfiguration.getIncludeEventTypes() method in GridGain configuration. Note that certain
events are required for GridGain's internal operations and such events will still be generated but not stored by
event storage SPI if they are disabled in GridGain configuration.
GridEventType.EVT_CACHE_ENTRY_CREATED,
GridEventType.EVT_CACHE_ENTRY_DESTROYED,
GridEventType.EVT_CACHE_ENTRY_EVICTED,
GridEventType.EVT_CACHE_OBJECT_PUT,
GridEventType.EVT_CACHE_OBJECT_READ,
GridEventType.EVT_CACHE_OBJECT_REMOVED,
GridEventType.EVT_CACHE_OBJECT_LOCKED,
GridEventType.EVT_CACHE_OBJECT_UNLOCKED,
GridEventType.EVT_CACHE_OBJECT_SWAPPED,
GridEventType.EVT_CACHE_OBJECT_UNSWAPPED,
GridEventType.EVT_CACHE_OBJECT_EXPIRED,
Serialized Form| Constructor and Description |
|---|
GridCacheEvent(String cacheName,
UUID nodeId,
UUID evtNodeId,
String msg,
int type,
int part,
boolean near,
Object key,
GridUuid xid,
Object lockId,
Object newVal,
boolean hasNewVal,
Object oldVal,
boolean hasOldVal)
Constructs cache event.
|
| Modifier and Type | Method and Description |
|---|---|
String |
cacheName()
Gets cache name.
|
UUID |
eventNodeId()
Gets ID of the node which initiated cache operation.
|
boolean |
hasNewValue()
Gets flag indicating whether cache entry has new value in case if
we only have new value in serialized form in which case
newValue()
will return null. |
boolean |
hasOldValue()
Gets flag indicating whether cache entry has old value in case if
we only have old value in serialized form in which case
oldValue()
will return null. |
boolean |
isNear()
Gets flag indicating whether event happened on
near or partitioned cache. |
<K> K |
key()
Gets cache entry associated with event.
|
Object |
lockId()
ID of the lock if held or null if no lock held.
|
Object |
newValue()
Gets new value for this event.
|
Object |
oldValue()
Gets old value associated with this event.
|
int |
partition()
Gets partition for the event which is the partition the key belongs to.
|
String |
shortDisplay()
Gets a shortened version of
toString() result. |
String |
toString() |
GridUuid |
xid()
ID of surrounding cache cache transaction or null if there is
no surrounding transaction.
|
public GridCacheEvent(String cacheName, UUID nodeId, UUID evtNodeId, String msg, int type, int part, boolean near, Object key, GridUuid xid, Object lockId, Object newVal, boolean hasNewVal, Object oldVal, boolean hasOldVal)
cacheName - Cache name.nodeId - Local node ID.evtNodeId - Event node ID.msg - Event message.type - Event type.part - Partition for the event (usually the partition the key belongs to).near - Flag indicating whether event happened on near or partitioned cache.key - Cache key.xid - Transaction ID.lockId - Lock ID.newVal - New value.hasNewVal - Flag indicating whether new value is present in case if we
don't have it in deserialized form.oldVal - Old value.hasOldVal - Flag indicating whether old value is present in case if we
don't have it in deserialized form.@Nullable public String cacheName()
public int partition()
public boolean isNear()
near or partitioned cache.near or partitioned cache.public UUID eventNodeId()
@Nullable public <K> K key()
@Nullable public GridUuid xid()
@Nullable public Object lockId()
@Nullable public Object newValue()
GridEventType.EVT_CACHE_OBJECT_REMOVED.@Nullable public Object oldValue()
public boolean hasOldValue()
oldValue()
will return null.public boolean hasNewValue()
newValue()
will return null.public String shortDisplay()
toString() result. Suitable for humans to read.shortDisplay in interface GridEventshortDisplay in class GridEventAdaptertoString() result.public String toString()
toString in class GridEventAdapter
Core Products
:
Data Grid ver. 6.0.2,
Streaming ver. 6.0.2
Accelerators
:
Hadoop Accelerator ver. 6.0.2
Release Date
:
March 24 2014