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 removeListener(Object listener)
           
 void start()
           
protected static 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 static 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()

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 static 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 static void testListenerMethodValidity(Method m,
                                                 Class<?> allowedParameter,
                                                 String annotationName)

-->

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