org.jboss.cache.notifications
Class NotifierImpl

java.lang.Object
  extended by org.jboss.cache.notifications.NotifierImpl
All Implemented Interfaces:
Notifier

public class NotifierImpl
extends Object
implements Notifier

Helper class that handles all notifications to registered listeners.

Author:
Manik Surtani (manik AT jboss DOT org), Galder Zamarreno

Constructor Summary
NotifierImpl()
           
 
Method Summary
 void addCacheListener(Object listener)
          Adds a cache listener to the list of cache listeners registered.
 Set<Object> getCacheListeners()
           
 void notifyBuddyGroupChange(BuddyGroup buddyGroup, boolean pre)
          Notifies all registered listeners of a buddy group change event.
 void notifyCacheBlocked(boolean pre)
           
 void notifyCacheStarted()
          Notifies all registered listeners of a cacheStarted event.
 void notifyCacheStopped()
          Notifies all registered listeners of a cacheStopped event.
 void notifyCacheUnblocked(boolean pre)
           
 void notifyNodeActivated(Fqn fqn, boolean pre, Map data, InvocationContext ctx)
          Notifies all registered listeners of a nodeActivated event.
 void notifyNodeCreated(Fqn fqn, boolean pre, InvocationContext ctx)
          Notifies all registered listeners of a nodeCreated event.
 void notifyNodeEvicted(Fqn fqn, boolean pre, InvocationContext ctx)
          Notifies all registered listeners of a nodeEvicted event.
 void notifyNodeInvalidated(Fqn fqn, boolean pre, InvocationContext ctx)
          Notifies all registered listeners of a nodeInvalidated event.
 void notifyNodeLoaded(Fqn fqn, boolean pre, Map data, InvocationContext ctx)
          Notifies all registered listeners of a nodeLoaded event.
 void notifyNodeModified(Fqn fqn, boolean pre, NodeModifiedEvent.ModificationType modificationType, Map data, InvocationContext ctx)
          Notifies all registered listeners of a nodeModified event.
 void notifyNodeMoved(Fqn originalFqn, Fqn newFqn, boolean pre, InvocationContext ctx)
          Notifies all registered listeners of a nodeMoved event.
 void notifyNodePassivated(Fqn fqn, boolean pre, Map data, InvocationContext ctx)
          Notifies all registered listeners of a nodePassivated event.
 void notifyNodeRemoved(Fqn fqn, boolean pre, Map data, InvocationContext ctx)
          Notifies all registered listeners of a nodeRemoved event.
 void notifyNodeVisited(Fqn fqn, boolean pre, InvocationContext ctx)
          Notifies all registered listeners of a nodeVisited event.
 void notifyTransactionCompleted(Transaction transaction, boolean successful, InvocationContext ctx)
          Notifies all registered listeners of a transaction completion event.
 void notifyTransactionRegistered(Transaction transaction, InvocationContext ctx)
          Notifies all registered listeners of a transaction registration event.
 void notifyViewChange(org.jgroups.View newView, InvocationContext ctx)
          Notifies all registered listeners of a viewChange event.
 void removeAllCacheListeners()
          Removes all listeners from the notifier, including the evictionPolicyListener.
 void removeCacheListener(Object listener)
          Removes a cache listener from the list of cache listeners registered.
 boolean shouldNotifyOnNodeModified()
          When notifying about node modifications, in many scenarios there is a need of building a new Map object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NotifierImpl

public NotifierImpl()
Method Detail

addCacheListener

public void addCacheListener(Object listener)
Description copied from interface: Notifier
Adds a cache listener to the list of cache listeners registered.

Specified by:
addCacheListener in interface Notifier

removeCacheListener

public void removeCacheListener(Object listener)
Description copied from interface: Notifier
Removes a cache listener from the list of cache listeners registered.

Specified by:
removeCacheListener in interface Notifier

removeAllCacheListeners

public void removeAllCacheListeners()
Removes all listeners from the notifier, including the evictionPolicyListener.


getCacheListeners

public Set<Object> getCacheListeners()
Specified by:
getCacheListeners in interface Notifier
Returns:
Retrieves an (unmodifiable) set of cache listeners registered.

notifyNodeCreated

public void notifyNodeCreated(Fqn fqn,
                              boolean pre,
                              InvocationContext ctx)
Description copied from interface: Notifier
Notifies all registered listeners of a nodeCreated event.

Specified by:
notifyNodeCreated in interface Notifier

notifyNodeModified

public void notifyNodeModified(Fqn fqn,
                               boolean pre,
                               NodeModifiedEvent.ModificationType modificationType,
                               Map data,
                               InvocationContext ctx)
Description copied from interface: Notifier
Notifies all registered listeners of a nodeModified event.

Specified by:
notifyNodeModified in interface Notifier

shouldNotifyOnNodeModified

public boolean shouldNotifyOnNodeModified()
Description copied from interface: Notifier
When notifying about node modifications, in many scenarios there is a need of building a new Map object. If no listeners are registered for notification then it is pointless building this object - so guard the notification with this call.

Specified by:
shouldNotifyOnNodeModified in interface Notifier

notifyNodeRemoved

public void notifyNodeRemoved(Fqn fqn,
                              boolean pre,
                              Map data,
                              InvocationContext ctx)
Description copied from interface: Notifier
Notifies all registered listeners of a nodeRemoved event.

Specified by:
notifyNodeRemoved in interface Notifier

notifyNodeVisited

public void notifyNodeVisited(Fqn fqn,
                              boolean pre,
                              InvocationContext ctx)
Description copied from interface: Notifier
Notifies all registered listeners of a nodeVisited event.

Specified by:
notifyNodeVisited in interface Notifier

notifyNodeMoved

public void notifyNodeMoved(Fqn originalFqn,
                            Fqn newFqn,
                            boolean pre,
                            InvocationContext ctx)
Description copied from interface: Notifier
Notifies all registered listeners of a nodeMoved event.

Specified by:
notifyNodeMoved in interface Notifier

notifyNodeEvicted

public void notifyNodeEvicted(Fqn fqn,
                              boolean pre,
                              InvocationContext ctx)
Description copied from interface: Notifier
Notifies all registered listeners of a nodeEvicted event.

Specified by:
notifyNodeEvicted in interface Notifier

notifyNodeInvalidated

public void notifyNodeInvalidated(Fqn fqn,
                                  boolean pre,
                                  InvocationContext ctx)
Description copied from interface: Notifier
Notifies all registered listeners of a nodeInvalidated event.

Specified by:
notifyNodeInvalidated in interface Notifier

notifyNodeLoaded

public void notifyNodeLoaded(Fqn fqn,
                             boolean pre,
                             Map data,
                             InvocationContext ctx)
Description copied from interface: Notifier
Notifies all registered listeners of a nodeLoaded event.

Specified by:
notifyNodeLoaded in interface Notifier

notifyNodeActivated

public void notifyNodeActivated(Fqn fqn,
                                boolean pre,
                                Map data,
                                InvocationContext ctx)
Description copied from interface: Notifier
Notifies all registered listeners of a nodeActivated event.

Specified by:
notifyNodeActivated in interface Notifier

notifyNodePassivated

public void notifyNodePassivated(Fqn fqn,
                                 boolean pre,
                                 Map data,
                                 InvocationContext ctx)
Description copied from interface: Notifier
Notifies all registered listeners of a nodePassivated event.

Specified by:
notifyNodePassivated in interface Notifier

notifyCacheStarted

public void notifyCacheStarted()
Notifies all registered listeners of a cacheStarted event.


notifyCacheStopped

public void notifyCacheStopped()
Notifies all registered listeners of a cacheStopped event.


notifyViewChange

public void notifyViewChange(org.jgroups.View newView,
                             InvocationContext ctx)
Description copied from interface: Notifier
Notifies all registered listeners of a viewChange event. Note that viewChange notifications are ALWAYS sent immediately.

Specified by:
notifyViewChange in interface Notifier

notifyBuddyGroupChange

public void notifyBuddyGroupChange(BuddyGroup buddyGroup,
                                   boolean pre)
Description copied from interface: Notifier
Notifies all registered listeners of a buddy group change event. Note that buddy group change notifications are ALWAYS sent immediately.

Specified by:
notifyBuddyGroupChange in interface Notifier
Parameters:
buddyGroup - buddy group to set
pre - if true, this has occured before the buddy group message is broadcast to the cluster

notifyTransactionCompleted

public void notifyTransactionCompleted(Transaction transaction,
                                       boolean successful,
                                       InvocationContext ctx)
Description copied from interface: Notifier
Notifies all registered listeners of a transaction completion event.

Specified by:
notifyTransactionCompleted in interface Notifier
Parameters:
transaction - the transaction that has just completed
successful - if true, the transaction committed. If false, this is a rollback event

notifyTransactionRegistered

public void notifyTransactionRegistered(Transaction transaction,
                                        InvocationContext ctx)
Description copied from interface: Notifier
Notifies all registered listeners of a transaction registration event.

Specified by:
notifyTransactionRegistered in interface Notifier
Parameters:
transaction - the transaction that has just completed

notifyCacheBlocked

public void notifyCacheBlocked(boolean pre)
Specified by:
notifyCacheBlocked in interface Notifier

notifyCacheUnblocked

public void notifyCacheUnblocked(boolean pre)
Specified by:
notifyCacheUnblocked in interface Notifier


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