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 java.lang.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 thefromEvent(CacheEntryEvent)method.- Since:
- 7.0
- Author:
- wburns
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classClusterEvent.Externalizer-
Nested classes/interfaces inherited from interface org.infinispan.notifications.cachelistener.event.Event
Event.Type
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)static <K,V>
ClusterEvent<K,V>fromEvent(CacheEntryEvent<K,V> event)Cache<K,V>getCache()GlobalTransactiongetGlobalTransaction()KgetKey()MetadatagetMetadata()Retrieves the metadata associated with the entry.VgetOldValue()Regardless of whether isPre() is true or is false, this method returns the value of the entry being deleted.Event.TypegetType()VgetValue()Retrieves the value of the entry being created.inthashCode()booleanisCommandRetried()This will be true if the write command that caused this had to be retried again due to a topology change.booleanisCreated()Indicates whether the cache entry modification event is the result of the cache entry being created.booleanisOriginLocal()booleanisPre()java.lang.StringtoString()-
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
isCurrentState
-
-
-
-
Method Detail
-
fromEvent
public static <K,V> ClusterEvent<K,V> fromEvent(CacheEntryEvent<K,V> event)
-
getValue
public V 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.
-
getMetadata
public Metadata 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
-
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
public V 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 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
public K getKey()
- Specified by:
getKeyin interfaceCacheEntryEvent<K,V>- Returns:
- the key to the affected cache entry.
-
getGlobalTransaction
public GlobalTransaction 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
public Event.Type getType()
-
isPre
public boolean isPre()
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-