Gemfire JavaDocs
Package org.apache.geode.cache
Interface EntryEvent<K,V>
-
- All Superinterfaces:
CacheEvent<K,V>
- All Known Subinterfaces:
TimestampedEntryEvent
public interface EntryEvent<K,V> extends CacheEvent<K,V>
Contains information about an event affecting an entry, including its identity and the the circumstances of the event. It is passed in toCacheListener
,CapacityController
, andCacheWriter
.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:
CacheListener
,CacheWriter
,RegionEvent
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description K
getKey()
Returns the key.V
getNewValue()
Returns the value in the cache after this event.V
getOldValue()
Returns the value in the cache prior to this event.SerializedCacheValue<V>
getSerializedNewValue()
Returns the serialized form of the value in the cache after this event.SerializedCacheValue<V>
getSerializedOldValue()
Returns the serialized form of the value in the cache before this event.TransactionId
getTransactionId()
Gets the TransactionId for this EntryEvent.boolean
hasClientOrigin()
Returns true if this event originated on a client.boolean
isOldValueAvailable()
Returnstrue
if the old value is "available".-
Methods inherited from interface org.apache.geode.cache.CacheEvent
getCallbackArgument, getDistributedMember, getOperation, getRegion, isCallbackArgumentAvailable, isOriginRemote
-
-
-
-
Method Detail
-
getKey
K getKey()
Returns the key.- Returns:
- the key
-
getOldValue
V getOldValue()
Returns the value in the cache prior to this event. The old value may be obtained lazily in some contexts for performance reasons. 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 casenull
is 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:
java.lang.IllegalStateException
- if off-heap and called after the method that was passed this EntryEvent returns.SerializationException
- if an error occurs deserializing the old valueCopyException
- if copy-on-read is set to true and the old value cannot be copied.CacheClosedException
- if the old value must be retrieved from disk or off-heap and the cache is closed.
-
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:
java.lang.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:
java.lang.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:
java.lang.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()
Returnstrue
if 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 returnnull
when this method returnsfalse
.- Returns:
- whether the old value is "available"
- Since:
- GemFire 6.0
-
-