Class AbstractListenerImpl<T,​L extends ListenerInvocation<T>>

    • Constructor Detail

      • AbstractListenerImpl

        public AbstractListenerImpl()
    • Method Detail

      • start

        public void start()
      • stop

        public void stop()
        Removes all listeners from the notifier
      • getLog

        protected abstract Log getLog()
      • getListenerCollectionForAnnotation

        protected List<L> getListenerCollectionForAnnotation​(Class<? extends Annotation> annotation)
      • removeListener

        public void removeListener​(Object listener)
      • removeListenerInvocation

        protected Set<L> removeListenerInvocation​(Class<? extends Annotation> annotation,
                                                  Object listener)
      • getListeners

        public Set<Object> getListeners()
      • validateAndAddListenerInvocations

        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. 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.
        Parameters:
        listener - object to be considered as a listener.
        builder - The builder to use to build the invocation
        Returns:
        true if annotated listener methods were found or false otherwise
      • testListenerClassValidity

        protected static Listener testListenerClassValidity​(Class<?> listenerClass)
        Tests if a class is properly annotated as a CacheListener and returns the Listener annotation.
        Parameters:
        listenerClass - class to inspect
        Returns:
        the Listener annotation
      • testListenerMethodValidity

        protected static void testListenerMethodValidity​(Method m,
                                                         Class<?> allowedParameter,
                                                         String annotationName)
      • suspendIfNeeded

        protected abstract Transaction suspendIfNeeded()
      • resumeIfNeeded

        protected abstract void resumeIfNeeded​(Transaction transaction)