Class ClusterEvent<K,V>
java.lang.Object
org.infinispan.notifications.cachelistener.cluster.ClusterEvent<K,V>
- All Implemented Interfaces:
CacheEntryCreatedEvent<K,
,V> CacheEntryEvent<K,
,V> CacheEntryExpiredEvent<K,
,V> CacheEntryModifiedEvent<K,
,V> CacheEntryRemovedEvent<K,
,V> Event<K,
,V> TransactionalEvent<K,
V>
public class ClusterEvent<K,V>
extends Object
implements CacheEntryCreatedEvent<K,V>, CacheEntryRemovedEvent<K,V>, CacheEntryModifiedEvent<K,V>, CacheEntryExpiredEvent<K,V>
This is an event designed for use with cluster listeners solely. This is the event that is serialized across the
wire when sending the event back to the node where the cluster listener is registered. You should only create
a ClusterEvent through the use of the
fromEvent(CacheEntryEvent)
method.- Since:
- 7.0
- Author:
- wburns
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.infinispan.notifications.cachelistener.event.Event
Event.Type
-
Method Summary
Modifier and TypeMethodDescriptionboolean
static <K,
V> ClusterEvent <K, V> fromEvent
(CacheEntryEvent<K, V> event) getCache()
getKey()
Retrieves the metadata associated with the entry.Retrieves the new value of the entry being modified.Regardless of whether isPre() is true or is false, this method returns the metadata of the entry being deleted.Regardless of whether isPre() is true or is false, this method returns the value of the entry being deleted.getType()
getValue()
Retrieves the value of the entry being created.int
hashCode()
boolean
This will be true if the write command that caused this had to be retried again due to a topology change.boolean
Indicates whether the cache entry modification event is the result of the cache entry being created.boolean
boolean
isPre()
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.infinispan.notifications.cachelistener.event.CacheEntryEvent
getSource, isCurrentState
-
Method Details
-
fromEvent
-
getValue
Description copied from interface:CacheEntryCreatedEvent
Retrieves the value of the entry being created.- Specified by:
getValue
in interfaceCacheEntryCreatedEvent<K,
V> - Specified by:
getValue
in interfaceCacheEntryEvent<K,
V> - Specified by:
getValue
in interfaceCacheEntryExpiredEvent<K,
V> - Specified by:
getValue
in interfaceCacheEntryModifiedEvent<K,
V> - Specified by:
getValue
in interfaceCacheEntryRemovedEvent<K,
V> - Returns:
- null if
Event.isPre()
is true, or the value being created ifEvent.isPre()
is false.
-
getNewValue
Description copied from interface:CacheEntryModifiedEvent
Retrieves the new value of the entry being modified.- Specified by:
getNewValue
in interfaceCacheEntryModifiedEvent<K,
V> - Returns:
- the new value of the entry, regardless of whether isPre() is true or false.
-
getMetadata
Description copied from interface:CacheEntryEvent
Retrieves the metadata associated with the entry.- Specified by:
getMetadata
in interfaceCacheEntryEvent<K,
V> - Returns:
- the metadata of the cache entry
-
getOldMetadata
Description copied from interface:CacheEntryRemovedEvent
Regardless of whether isPre() is true or is false, this method returns the metadata of the entry being deleted. This method is useful for situations where cache listeners need to know what the old value being deleted is when getting isPre() is false callbacks.- Specified by:
getOldMetadata
in interfaceCacheEntryModifiedEvent<K,
V> - Specified by:
getOldMetadata
in interfaceCacheEntryRemovedEvent<K,
V> - Returns:
- the metadata of the entry being deleted, regardless of isPre() value
-
isCommandRetried
public boolean isCommandRetried()Description copied from interface:CacheEntryCreatedEvent
This will be true if the write command that caused this had to be retried again due to a topology change. This could be a sign that this event has been duplicated or another event was dropped and replaced (eg: ModifiedEvent replaced CreateEvent)- Specified by:
isCommandRetried
in interfaceCacheEntryCreatedEvent<K,
V> - Specified by:
isCommandRetried
in interfaceCacheEntryModifiedEvent<K,
V> - Specified by:
isCommandRetried
in interfaceCacheEntryRemovedEvent<K,
V> - Returns:
- Whether the command that caused this event was retried
-
getOldValue
Description copied from interface:CacheEntryRemovedEvent
Regardless of whether isPre() is true or is false, this method returns the value of the entry being deleted. This method is useful for situations where cache listeners need to know what the old value being deleted is when getting isPre() is false callbacks.- Specified by:
getOldValue
in interfaceCacheEntryModifiedEvent<K,
V> - Specified by:
getOldValue
in interfaceCacheEntryRemovedEvent<K,
V> - Returns:
- the value of the entry being deleted, regardless of isPre() value
-
isCreated
public boolean isCreated()Description copied from interface:CacheEntryModifiedEvent
Indicates whether the cache entry modification event is the result of the cache entry being created. This method helps determine if the cache entry was created when event.isPre() is false.- Specified by:
isCreated
in interfaceCacheEntryModifiedEvent<K,
V> - Returns:
- true if the event is the result of the entry being created, otherwise it returns false indicating that the event was the result of a cache entry being updated
-
getKey
- Specified by:
getKey
in interfaceCacheEntryEvent<K,
V> - Returns:
- the key to the affected cache entry.
-
getGlobalTransaction
- Specified by:
getGlobalTransaction
in interfaceTransactionalEvent<K,
V> - Returns:
- the Transaction associated with the current call. May be null if the current call is outside the scope of a transaction.
-
isOriginLocal
public boolean isOriginLocal()- Specified by:
isOriginLocal
in interfaceTransactionalEvent<K,
V> - Returns:
- true if the call originated on the local cache instance; false if originated from a remote one.
-
getType
-
isPre
public boolean isPre() -
getCache
-
equals
-
hashCode
public int hashCode() -
toString
-