T
- Defines the type of event that will be used by the subclassL
- Defines the type of ListenerInvocations that the subclasses usepublic abstract class AbstractListenerImpl<T,L extends ListenerInvocation<T>> extends Object
CacheManagerNotifierImpl
and
CacheNotifierImpl
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractListenerImpl.AbstractInvocationBuilder |
protected class |
AbstractListenerImpl.ListenerInvocationImpl<A>
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.
|
Modifier and Type | Field and Description |
---|---|
protected ExecutorService |
asyncProcessor |
protected Map<Class<? extends Annotation>,List<L>> |
listenersMap |
protected ExecutorService |
syncProcessor |
Constructor and Description |
---|
AbstractListenerImpl() |
Modifier and Type | Method and Description |
---|---|
protected abstract Map<Class<? extends Annotation>,Class<?>> |
getAllowedMethodAnnotations(Listener l) |
protected List<L> |
getListenerCollectionForAnnotation(Class<? extends Annotation> annotation) |
Set<Object> |
getListeners() |
protected abstract Log |
getLog() |
void |
removeListener(Object listener) |
protected Set<L> |
removeListenerInvocation(Class<? extends Annotation> annotation,
Object listener) |
protected abstract void |
resumeIfNeeded(Transaction transaction) |
void |
start() |
void |
stop()
Removes all listeners from the notifier
|
protected abstract Transaction |
suspendIfNeeded() |
protected static Listener |
testListenerClassValidity(Class<?> listenerClass)
Tests if a class is properly annotated as a CacheListener and returns the Listener annotation.
|
protected static void |
testListenerMethodValidity(Method m,
Class<?> allowedParameter,
String annotationName) |
protected boolean |
validateAndAddListenerInvocations(Object listener,
AbstractListenerImpl.AbstractInvocationBuilder builder)
Loops through all valid methods on the object passed in, and caches the relevant methods as
ListenerInvocation for invocation by reflection. |
protected final Map<Class<? extends Annotation>,List<L extends ListenerInvocation<T>>> listenersMap
protected ExecutorService syncProcessor
protected ExecutorService asyncProcessor
public void start()
public void stop()
protected abstract Log getLog()
protected abstract Map<Class<? extends Annotation>,Class<?>> getAllowedMethodAnnotations(Listener l)
protected List<L> getListenerCollectionForAnnotation(Class<? extends Annotation> annotation)
public void removeListener(Object listener)
protected Set<L> removeListenerInvocation(Class<? extends Annotation> annotation, Object listener)
protected boolean validateAndAddListenerInvocations(Object listener, AbstractListenerImpl.AbstractInvocationBuilder builder)
ListenerInvocation
for invocation by reflection.
The builder provided will be used to create the listener invocations. This method will set the target, subject
sync, and methods as needed. If other values are needed to be set they should be invoked before passing to this method.listener
- object to be considered as a listener.builder
- The builder to use to build the invocationtrue
if annotated listener methods were found or false
otherwiseprotected static Listener testListenerClassValidity(Class<?> listenerClass)
listenerClass
- class to inspectprotected static void testListenerMethodValidity(Method m, Class<?> allowedParameter, String annotationName)
protected abstract Transaction suspendIfNeeded()
protected abstract void resumeIfNeeded(Transaction transaction)
Copyright © 2023 JBoss, a division of Red Hat. All rights reserved.