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 ClassesNested classes/interfaces inherited from interface org.infinispan.notifications.cachelistener.event.Event
Event.Type -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic <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.inthashCode()booleanThis will be true if the write command that caused this had to be retried again due to a topology change.booleanIndicates whether the cache entry modification event is the result of the cache entry being created.booleanbooleanisPre()toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.infinispan.notifications.cachelistener.event.CacheEntryEvent
getSource, isCurrentState
-
Method Details
-
fromEvent
-
getValue
Description copied from interface:CacheEntryCreatedEventRetrieves the value of the entry being created.- Specified by:
getValuein interfaceCacheEntryCreatedEvent<K,V> - Specified by:
getValuein interfaceCacheEntryEvent<K,V> - Specified by:
getValuein interfaceCacheEntryExpiredEvent<K,V> - Specified by:
getValuein interfaceCacheEntryModifiedEvent<K,V> - Specified by:
getValuein interfaceCacheEntryRemovedEvent<K,V> - Returns:
- null if
Event.isPre()is true, or the value being created ifEvent.isPre()is false.
-
getNewValue
Description copied from interface:CacheEntryModifiedEventRetrieves the new value of the entry being modified.- Specified by:
getNewValuein interfaceCacheEntryModifiedEvent<K,V> - Returns:
- the new value of the entry, regardless of whether isPre() is true or false.
-
getMetadata
Description copied from interface:CacheEntryEventRetrieves the metadata associated with the entry.- Specified by:
getMetadatain interfaceCacheEntryEvent<K,V> - Returns:
- the metadata of the cache entry
-
getOldMetadata
Description copied from interface:CacheEntryRemovedEventRegardless 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:
getOldMetadatain interfaceCacheEntryModifiedEvent<K,V> - Specified by:
getOldMetadatain interfaceCacheEntryRemovedEvent<K,V> - Returns:
- the metadata of the entry being deleted, regardless of isPre() value
-
isCommandRetried
public boolean isCommandRetried()Description copied from interface:CacheEntryCreatedEventThis 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:
isCommandRetriedin interfaceCacheEntryCreatedEvent<K,V> - Specified by:
isCommandRetriedin interfaceCacheEntryModifiedEvent<K,V> - Specified by:
isCommandRetriedin interfaceCacheEntryRemovedEvent<K,V> - Returns:
- Whether the command that caused this event was retried
-
getOldValue
Description copied from interface:CacheEntryRemovedEventRegardless 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:
getOldValuein interfaceCacheEntryModifiedEvent<K,V> - Specified by:
getOldValuein interfaceCacheEntryRemovedEvent<K,V> - Returns:
- the value of the entry being deleted, regardless of isPre() value
-
isCreated
public boolean isCreated()Description copied from interface:CacheEntryModifiedEventIndicates 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:
isCreatedin 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:
getKeyin interfaceCacheEntryEvent<K,V> - Returns:
- the key to the affected cache entry.
-
getGlobalTransaction
- Specified by:
getGlobalTransactionin 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:
isOriginLocalin 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
-