Package org.apache.geode.cache
Interface EntryEvent<K,V>
- All Superinterfaces:
CacheEvent<K,V>
- All Known Subinterfaces:
TimestampedEntryEvent
Contains information about an event affecting an entry, including its identity and the the
circumstances of the event. It is passed in to
CacheListener,
CapacityController, and CacheWriter.
If this event originated from a region stored off heap then this event can only be used as long
as the notification method that obtained it has not returned. For example in your implementation
of CacheListener.afterUpdate(EntryEvent) the event parameter is only valid until your
afterUpdate method returns. It is not safe to store instances of this class and use them later
when using off heap storage. Attempts to access off-heap data from this event after it has
expired will result in an IllegalStateException.
- Since:
- GemFire 3.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongetKey()Returns the key.Returns the value in the cache after this event.Returns the value in the cache prior to this event.Returns the serialized form of the value in the cache after this event.Returns the serialized form of the value in the cache before this event.Gets the TransactionId for this EntryEvent.booleanReturns true if this event originated on a client.booleanReturnstrueif the old value is "available".Methods inherited from interface org.apache.geode.cache.CacheEvent
getCallbackArgument, getDistributedMember, getOperation, getRegion, isCallbackArgumentAvailable, isOriginRemote
-
Method Details
-
getKey
K getKey()Returns the key.- Returns:
- the key
-
getOldValue
V getOldValue()Returns the value in the cache prior to this event. When passed to an event handler after an event occurs, this value reflects the value that was in the cache in this VM, not necessarily the value that was in the cache VM that initiated the operation. In certain scenarios the old value may no longer be available in which casenullis returned. This can happen for disk regions when the old value is on disk only.- Returns:
- the old value in the cache prior to this event. If the entry did not exist, was invalid, or was not available, then null is returned.
- Throws:
IllegalStateException- if off-heap and called after the method that was passed this EntryEvent returns.
-
getSerializedOldValue
SerializedCacheValue<V> getSerializedOldValue()Returns the serialized form of the value in the cache before this event.- Returns:
- the serialized form of the value in the cache before this event
- Throws:
IllegalStateException- if off-heap and called after the method that was passed this EntryEvent returns.- Since:
- GemFire 5.5
-
getNewValue
V getNewValue()Returns the value in the cache after this event.- Returns:
- the value in the cache after this event
- Throws:
IllegalStateException- if off-heap and called after the method that was passed this EntryEvent returns.
-
getSerializedNewValue
SerializedCacheValue<V> getSerializedNewValue()Returns the serialized form of the value in the cache after this event.- Returns:
- the serialized form of the value in the cache after this event
- Throws:
IllegalStateException- if off-heap and called after the method that was passed this EntryEvent returns.- Since:
- GemFire 5.5
-
getTransactionId
TransactionId getTransactionId()Gets the TransactionId for this EntryEvent.- Returns:
- the ID of the transaction that performed the operation that generated this event; null if no transaction involved.
- Since:
- GemFire 4.0
-
hasClientOrigin
boolean hasClientOrigin()Returns true if this event originated on a client.- Returns:
- true if this event originated on a client.
- Since:
- GemFire 5.7
-
isOldValueAvailable
boolean isOldValueAvailable()Returnstrueif the old value is "available". Not available means that an old value existed but it could not be obtained or it was deemed too expensive to obtain. Note thatgetOldValue()will returnnullwhen this method returnsfalse.- Returns:
- whether the old value is "available"
- Since:
- GemFire 6.0
-