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 class
ClusterEvent.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 boolean
equals(java.lang.Object o)
static <K,V>
ClusterEvent<K,V>fromEvent(CacheEntryEvent<K,V> event)
Cache<K,V>
getCache()
GlobalTransaction
getGlobalTransaction()
K
getKey()
Metadata
getMetadata()
Retrieves the metadata associated with the entry.V
getOldValue()
Regardless of whether isPre() is true or is false, this method returns the value of the entry being deleted.Event.Type
getType()
V
getValue()
Retrieves the value of the entry being created.int
hashCode()
boolean
isCommandRetried()
This will be true if the write command that caused this had to be retried again due to a topology change.boolean
isCreated()
Indicates whether the cache entry modification event is the result of the cache entry being created.boolean
isOriginLocal()
boolean
isPre()
java.lang.String
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
isCurrentState
-
-
-
-
Method Detail
-
fromEvent
public static <K,V> ClusterEvent<K,V> fromEvent(CacheEntryEvent<K,V> event)
-
getValue
public V 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.
-
getMetadata
public Metadata 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
-
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
public V 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 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
public K getKey()
- Specified by:
getKey
in interfaceCacheEntryEvent<K,V>
- Returns:
- the key to the affected cache entry.
-
getGlobalTransaction
public GlobalTransaction 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
public Event.Type getType()
-
isPre
public boolean isPre()
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-