org.infinispan.notifications.cachelistener.event
Class EventImpl<K,V>

java.lang.Object
  extended by org.infinispan.notifications.cachelistener.event.EventImpl<K,V>
All Implemented Interfaces:
CacheEntriesEvictedEvent, CacheEntryActivatedEvent, CacheEntryCreatedEvent, CacheEntryEvent, CacheEntryEvictedEvent, CacheEntryInvalidatedEvent, CacheEntryLoadedEvent, CacheEntryModifiedEvent, CacheEntryPassivatedEvent, CacheEntryRemovedEvent, CacheEntryVisitedEvent, DataRehashedEvent, Event, TopologyChangedEvent, TransactionalEvent, TransactionCompletedEvent, TransactionRegisteredEvent

@NotThreadSafe
public class EventImpl<K,V>
extends Object
implements CacheEntryActivatedEvent, CacheEntryCreatedEvent, CacheEntriesEvictedEvent, CacheEntryLoadedEvent, CacheEntryModifiedEvent, CacheEntryPassivatedEvent, CacheEntryRemovedEvent, CacheEntryVisitedEvent, TransactionCompletedEvent, TransactionRegisteredEvent, CacheEntryInvalidatedEvent, DataRehashedEvent, TopologyChangedEvent, CacheEntryEvictedEvent

Basic implementation of an event that covers all event types.

Since:
4.0
Author:
Manik Surtani

Constructor Summary
EventImpl()
           
 
Method Summary
static
<K,V> EventImpl<K,V>
createEvent(Cache<K,V> cache, Event.Type type)
           
 boolean equals(Object o)
           
 Cache<K,V> getCache()
           
 ConsistentHash getConsistentHashAtEnd()
           
 ConsistentHash getConsistentHashAtStart()
           
 Map<K,V> getEntries()
          Retrieves entries being evicted.
 GlobalTransaction getGlobalTransaction()
           
 K getKey()
           
 Collection<Address> getMembersAtEnd()
           
 Collection<Address> getMembersAtStart()
           
 long getNewViewId()
           
 Event.Type getType()
           
 V getValue()
          Retrieves the value of the entry being activated.
 int hashCode()
           
 boolean isOriginLocal()
           
 boolean isPre()
           
 boolean isTransactionSuccessful()
           
 void setCache(Cache<K,V> cache)
           
 void setConsistentHashAtEnd(ConsistentHash consistentHashAtEnd)
           
 void setConsistentHashAtStart(ConsistentHash consistentHashAtStart)
           
 void setEntries(Map<Object,Object> entries)
           
 void setKey(K key)
           
 void setMembersAtEnd(Collection<Address> membersAtEnd)
           
 void setMembersAtStart(Collection<Address> membersAtStart)
           
 void setNewViewId(long newViewId)
           
 void setOriginLocal(boolean originLocal)
           
 void setPre(boolean pre)
           
 void setTransactionId(GlobalTransaction transaction)
           
 void setTransactionSuccessful(boolean transactionSuccessful)
           
 void setType(Event.Type type)
           
 void setValue(V value)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EventImpl

public EventImpl()
Method Detail

createEvent

public static <K,V> EventImpl<K,V> createEvent(Cache<K,V> cache,
                                               Event.Type type)

getType

public Event.Type getType()
Specified by:
getType in interface Event
Returns:
the type of event represented by this instance.

isPre

public boolean isPre()
Specified by:
isPre in interface Event
Returns:
true if the notification is before the event has occurred, false if after the event has occurred.

getCache

public Cache<K,V> getCache()
Specified by:
getCache in interface Event
Returns:
a handle to the cache instance that generated this notification.

getKey

public K getKey()
Specified by:
getKey in interface CacheEntryEvent
Returns:
the key to the affected cache entry.

getGlobalTransaction

public GlobalTransaction getGlobalTransaction()
Specified by:
getGlobalTransaction in interface TransactionalEvent
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 interface TransactionalEvent
Returns:
true if the call originated on the local cache instance; false if originated from a remote one.

isTransactionSuccessful

public boolean isTransactionSuccessful()
Specified by:
isTransactionSuccessful in interface TransactionCompletedEvent
Returns:
if true, the transaction completed by committing successfully. If false, the transaction completed with a rollback.

setPre

public void setPre(boolean pre)

setCache

public void setCache(Cache<K,V> cache)

setKey

public void setKey(K key)

setTransactionId

public void setTransactionId(GlobalTransaction transaction)

setOriginLocal

public void setOriginLocal(boolean originLocal)

setTransactionSuccessful

public void setTransactionSuccessful(boolean transactionSuccessful)

setType

public void setType(Event.Type type)

setMembersAtStart

public void setMembersAtStart(Collection<Address> membersAtStart)

setMembersAtEnd

public void setMembersAtEnd(Collection<Address> membersAtEnd)

setConsistentHashAtStart

public void setConsistentHashAtStart(ConsistentHash consistentHashAtStart)

setConsistentHashAtEnd

public void setConsistentHashAtEnd(ConsistentHash consistentHashAtEnd)

setNewViewId

public void setNewViewId(long newViewId)

getValue

public V getValue()
Description copied from interface: CacheEntryActivatedEvent
Retrieves the value of the entry being activated.

Specified by:
getValue in interface CacheEntryActivatedEvent
Specified by:
getValue in interface CacheEntryEvictedEvent
Specified by:
getValue in interface CacheEntryInvalidatedEvent
Specified by:
getValue in interface CacheEntryLoadedEvent
Specified by:
getValue in interface CacheEntryModifiedEvent
Specified by:
getValue in interface CacheEntryPassivatedEvent
Specified by:
getValue in interface CacheEntryRemovedEvent
Specified by:
getValue in interface CacheEntryVisitedEvent
Returns:
the value of the activated entry

setValue

public void setValue(V value)

setEntries

public void setEntries(Map<Object,Object> entries)

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

getMembersAtStart

public Collection<Address> getMembersAtStart()
Specified by:
getMembersAtStart in interface DataRehashedEvent
Returns:
Retrieves the list of members before rehashing started.

getMembersAtEnd

public Collection<Address> getMembersAtEnd()
Specified by:
getMembersAtEnd in interface DataRehashedEvent
Returns:
Retrieves the list of members after rehashing ended.

getNewViewId

public long getNewViewId()
Specified by:
getNewViewId in interface DataRehashedEvent
Returns:
Retrieves the new view id after rehashing was triggered.

getConsistentHashAtStart

public ConsistentHash getConsistentHashAtStart()
Specified by:
getConsistentHashAtStart in interface TopologyChangedEvent
Returns:
retrieves the consistent hash at the start of a topology change

getConsistentHashAtEnd

public ConsistentHash getConsistentHashAtEnd()
Specified by:
getConsistentHashAtEnd in interface TopologyChangedEvent
Returns:
retrieves the consistent hash at the end of a topology change

getEntries

public Map<K,V> getEntries()
Description copied from interface: CacheEntriesEvictedEvent
Retrieves entries being evicted.

Specified by:
getEntries in interface CacheEntriesEvictedEvent
Returns:
A map containing the key/value pairs of the cache entries being evicted.

-->

Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.