public class CacheEvent extends EventAdapter
Grid events are used for notification about what happens within the grid. Note that by design Ignite keeps all events generated on the local node locally and it provides APIs for performing a distributed queries across multiple nodes:
IgniteEvents.remoteQuery(IgnitePredicate, long, int...)
-
asynchronously querying events occurred on the nodes specified, including remote nodes.
IgniteEvents.localQuery(IgnitePredicate, int...)
-
querying only local events stored on this local node.
IgniteEvents.localListen(IgnitePredicate, int...)
-
listening to local grid events (events from remote nodes not included).
IgniteEvents.waitForLocal(IgnitePredicate, int...)
.
It is highly recommended to enable only those events that your application logic requires
by using IgniteConfiguration.getIncludeEventTypes()
method in Ignite configuration. Note that certain
events are required for Ignite's internal operations and such events will still be generated but not stored by
event storage SPI if they are disabled in Ignite configuration.
EventType.EVT_CACHE_STARTED
,
EventType.EVT_CACHE_STOPPED
,
EventType.EVT_CACHE_NODES_LEFT
,
EventType.EVTS_CACHE_LIFECYCLE
,
EventType.EVT_CACHE_ENTRY_CREATED
,
EventType.EVT_CACHE_ENTRY_DESTROYED
,
EventType.EVT_CACHE_ENTRY_EVICTED
,
EventType.EVT_CACHE_OBJECT_EXPIRED
,
EventType.EVT_CACHE_OBJECT_LOCKED
,
EventType.EVT_CACHE_OBJECT_PUT
,
EventType.EVT_CACHE_OBJECT_READ
,
EventType.EVT_CACHE_OBJECT_REMOVED
,
EventType.EVT_CACHE_OBJECT_UNLOCKED
,
EventType.EVTS_CACHE
,
Serialized FormConstructor and Description |
---|
CacheEvent(String cacheName,
ClusterNode node,
@Nullable ClusterNode evtNode,
String msg,
int type,
int part,
boolean near,
Object key,
IgniteUuid xid,
String txLbl,
Object lockId,
Object newVal,
boolean hasNewVal,
Object oldVal,
boolean hasOldVal,
UUID subjId,
String cloClsName,
String taskName)
Constructs cache event.
|
Modifier and Type | Method and Description |
---|---|
String |
cacheName()
Gets cache name.
|
String |
closureClassName()
Gets closure class name (applicable only for TRANSFORM operations).
|
ClusterNode |
eventNode()
Gets node which initiated cache operation or
null if that node is not available. |
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. |
UUID |
subjectId()
Gets security subject ID initiated this cache event, if available.
|
String |
taskName()
Gets task name if cache event was caused by an operation initiated within task execution.
|
String |
toString() |
String |
txLabel()
Label of surrounding cache transaction or null if there either is
no surrounding transaction or label was not set.
|
IgniteUuid |
xid()
ID of surrounding cache transaction or null if there is
no surrounding transaction.
|
public CacheEvent(String cacheName, ClusterNode node, @Nullable @Nullable ClusterNode evtNode, String msg, int type, int part, boolean near, Object key, IgniteUuid xid, String txLbl, Object lockId, Object newVal, boolean hasNewVal, Object oldVal, boolean hasOldVal, UUID subjId, String cloClsName, String taskName)
cacheName
- Cache name.node
- Local node.evtNode
- 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.txLbl
- Transaction label.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.subjId
- Subject ID.cloClsName
- Closure class name.public String cacheName()
public int partition()
public boolean isNear()
near
or partitioned
cache.near
or partitioned
cache.public ClusterNode eventNode()
null
if that node is not available.null
if that node is not available.public <K> K key()
public IgniteUuid xid()
public String txLabel()
public Object lockId()
public Object newValue()
EventType.EVT_CACHE_OBJECT_REMOVED
.public Object oldValue()
public boolean hasOldValue()
oldValue()
will return null
.public boolean hasNewValue()
newValue()
will return null
.public UUID subjectId()
EventType.EVT_CACHE_OBJECT_PUT
, EventType.EVT_CACHE_OBJECT_REMOVED
and
EventType.EVT_CACHE_OBJECT_READ
cache events.
Subject ID will be set either to nodeId initiated cache update or read or client ID initiated cache update or read.
public String closureClassName()
public String taskName()
public String shortDisplay()
toString()
result. Suitable for humans to read.shortDisplay
in interface Event
shortDisplay
in class EventAdapter
toString()
result.public String toString()
toString
in class EventAdapter
GridGain In-Memory Computing Platform : ver. 8.9.15 Release Date : December 3 2024