org.jboss.cache.notifications
Class Notifier

java.lang.Object
  extended by org.jboss.cache.notifications.Notifier

public class Notifier
extends Object

Helper class that handles all notifications to registered listeners.

Author:
Manik Surtani (manik@jboss.org)

Constructor Summary
Notifier()
           
Notifier(Cache cache)
           
 
Method Summary
 void addCacheListener(Object listener)
          Adds a cache listener to the list of cache listeners registered.
protected  void destroy()
           
 Set<Object> getCacheListeners()
           
 void notifyBuddyGroupChange(BuddyGroup buddyGroup, boolean pre)
          Notifies all registered listeners of a buddy group change event.
 void notifyCacheBlocked(CacheSPI cache, boolean pre)
           
 void notifyCacheStarted(CacheSPI cache, InvocationContext ctx)
          Notifies all registered listeners of a cacheStarted event.
 void notifyCacheStopped(CacheSPI cache, InvocationContext ctx)
          Notifies all registered listeners of a cacheStopped event.
 void notifyCacheUnblocked(CacheSPI cache, 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 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)
           
 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 new_view, 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Notifier

public Notifier()

Notifier

public Notifier(Cache cache)
Method Detail

destroy

protected void destroy()

addCacheListener

public void addCacheListener(Object listener)
Adds a cache listener to the list of cache listeners registered.

Parameters:
listener -

removeCacheListener

public void removeCacheListener(Object listener)
Removes a cache listener from the list of cache listeners registered.

Parameters:
listener -

removeAllCacheListeners

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


getCacheListeners

public Set<Object> getCacheListeners()
Returns:
Retrieves an (unmodifiable) set of cache listeners registered.

notifyNodeCreated

public void notifyNodeCreated(Fqn fqn,
                              boolean pre,
                              InvocationContext ctx)
Notifies all registered listeners of a nodeCreated event.

Parameters:
fqn -
pre -
ctx - context of invocation

notifyNodeModified

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

Parameters:
fqn -
pre -
modificationType -
data -
ctx - context of invocation

notifyNodeRemoved

public void notifyNodeRemoved(Fqn fqn,
                              boolean pre,
                              Map data,
                              InvocationContext ctx)
Notifies all registered listeners of a nodeRemoved event.

Parameters:
fqn -
pre -
data -
ctx - context of invocation

notifyNodeVisited

public void notifyNodeVisited(Fqn fqn,
                              boolean pre,
                              InvocationContext ctx)
Notifies all registered listeners of a nodeVisited event.

Parameters:
fqn -
pre -
ctx - context of invocation

notifyNodeMoved

public void notifyNodeMoved(Fqn originalFqn,
                            Fqn newFqn,
                            boolean pre,
                            InvocationContext ctx)

notifyNodeEvicted

public void notifyNodeEvicted(Fqn fqn,
                              boolean pre,
                              InvocationContext ctx)
Notifies all registered listeners of a nodeEvicted event.

Parameters:
fqn -
pre -
ctx - context of invocation

notifyNodeLoaded

public void notifyNodeLoaded(Fqn fqn,
                             boolean pre,
                             Map data,
                             InvocationContext ctx)
Notifies all registered listeners of a nodeLoaded event.

Parameters:
fqn -
pre -
data -
ctx - context of invocation

notifyNodeActivated

public void notifyNodeActivated(Fqn fqn,
                                boolean pre,
                                Map data,
                                InvocationContext ctx)
Notifies all registered listeners of a nodeActivated event.

Parameters:
fqn -
pre -
data -
ctx - context of invocation

notifyNodePassivated

public void notifyNodePassivated(Fqn fqn,
                                 boolean pre,
                                 Map data,
                                 InvocationContext ctx)
Notifies all registered listeners of a nodePassivated event.

Parameters:
fqn -
pre -
data -
ctx - context of invocation

notifyCacheStarted

public void notifyCacheStarted(CacheSPI cache,
                               InvocationContext ctx)
Notifies all registered listeners of a cacheStarted event.

Parameters:
cache - cache instance to notify
ctx - context of invocation

notifyCacheStopped

public void notifyCacheStopped(CacheSPI cache,
                               InvocationContext ctx)
Notifies all registered listeners of a cacheStopped event.

Parameters:
cache - cache instance to notify
ctx - context of invocation

notifyViewChange

public void notifyViewChange(org.jgroups.View new_view,
                             InvocationContext ctx)
Notifies all registered listeners of a viewChange event. Note that viewChange notifications are ALWAYS sent immediately.

Parameters:
new_view -
ctx - context of invocation

notifyBuddyGroupChange

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

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)
Notifies all registered listeners of a transaction completion event.

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)
Notifies all registered listeners of a transaction registration event.

Parameters:
transaction - the transaction that has just completed

notifyCacheBlocked

public void notifyCacheBlocked(CacheSPI cache,
                               boolean pre)

notifyCacheUnblocked

public void notifyCacheUnblocked(CacheSPI cache,
                                 boolean pre)


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