org.infinispan.notifications
Class AbstractListenerImpl

java.lang.Object
  extended by org.infinispan.notifications.AbstractListenerImpl
Direct Known Subclasses:
CacheManagerNotifierImpl, CacheNotifierImpl

public abstract class AbstractListenerImpl
extends Object

Functionality common to both CacheManagerNotifierImpl and CacheNotifierImpl

Author:
Manik Surtani

Nested Class Summary
protected  class AbstractListenerImpl.ListenerInvocation
          Class that encapsulates a valid invocation for a given registered listener - containing a reference to the method to be invoked as well as the target object.
 
Field Summary
protected  ExecutorService asyncProcessor
           
protected  Map<Class<? extends Annotation>,List<AbstractListenerImpl.ListenerInvocation>> listenersMap
           
protected  ExecutorService syncProcessor
           
 
Constructor Summary
AbstractListenerImpl()
           
 
Method Summary
 void addListener(Object listener)
           
protected abstract  Map<Class<? extends Annotation>,Class> getAllowedMethodAnnotations()
           
protected  List<AbstractListenerImpl.ListenerInvocation> getListenerCollectionForAnnotation(Class<? extends Annotation> annotation)
           
 Set<Object> getListeners()
           
protected abstract  Log getLog()
           
 void removeAllCacheListeners()
          Removes all listeners from the notifier
 void removeListener(Object listener)
           
 void start()
           
protected  boolean testListenerClassValidity(Class<?> listenerClass)
          Tests if a class is properly annotated as a CacheListener and returns whether callbacks on this class should be invoked synchronously or asynchronously.
protected  void testListenerMethodValidity(Method m, Class allowedParameter, String annotationName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listenersMap

protected final Map<Class<? extends Annotation>,List<AbstractListenerImpl.ListenerInvocation>> listenersMap

syncProcessor

protected ExecutorService syncProcessor

asyncProcessor

protected ExecutorService asyncProcessor
Constructor Detail

AbstractListenerImpl

public AbstractListenerImpl()
Method Detail

start

public void start()

removeAllCacheListeners

public void removeAllCacheListeners()
Removes all listeners from the notifier


getLog

protected abstract Log getLog()

getAllowedMethodAnnotations

protected abstract Map<Class<? extends Annotation>,Class> getAllowedMethodAnnotations()

getListenerCollectionForAnnotation

protected List<AbstractListenerImpl.ListenerInvocation> getListenerCollectionForAnnotation(Class<? extends Annotation> annotation)

removeListener

public void removeListener(Object listener)

addListener

public void addListener(Object listener)

getListeners

public Set<Object> getListeners()

testListenerClassValidity

protected boolean testListenerClassValidity(Class<?> listenerClass)
Tests if a class is properly annotated as a CacheListener and returns whether callbacks on this class should be invoked synchronously or asynchronously.

Parameters:
listenerClass - class to inspect
Returns:
true if callbacks on this class should use the syncProcessor; false if it should use the asyncProcessor.

testListenerMethodValidity

protected void testListenerMethodValidity(Method m,
                                          Class allowedParameter,
                                          String annotationName)

Google Analytics

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