Class CacheNotifierImpl<K,​V>

    • Constructor Detail

      • CacheNotifierImpl

        public CacheNotifierImpl()
    • Method Detail

      • stop

        public void stop()
        Description copied from class: org.infinispan.notifications.impl.AbstractListenerImpl
        Removes all listeners from the notifier
        Overrides:
        stop in class org.infinispan.notifications.impl.AbstractListenerImpl<Event<K,​V>,​CacheEntryListenerInvocation<K,​V>>
      • getLog

        protected org.infinispan.util.logging.Log getLog()
        Specified by:
        getLog in class org.infinispan.notifications.impl.AbstractListenerImpl<Event<K,​V>,​CacheEntryListenerInvocation<K,​V>>
      • getAllowedMethodAnnotations

        protected java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,​java.lang.Class<?>> getAllowedMethodAnnotations​(Listener l)
        Specified by:
        getAllowedMethodAnnotations in class org.infinispan.notifications.impl.AbstractListenerImpl<Event<K,​V>,​CacheEntryListenerInvocation<K,​V>>
      • suspendIfNeeded

        protected final javax.transaction.Transaction suspendIfNeeded()
        Specified by:
        suspendIfNeeded in class org.infinispan.notifications.impl.AbstractListenerImpl<Event<K,​V>,​CacheEntryListenerInvocation<K,​V>>
      • resumeIfNeeded

        protected final void resumeIfNeeded​(javax.transaction.Transaction transaction)
        Specified by:
        resumeIfNeeded in class org.infinispan.notifications.impl.AbstractListenerImpl<Event<K,​V>,​CacheEntryListenerInvocation<K,​V>>
      • notifyTransactionCompleted

        public void notifyTransactionCompleted​(GlobalTransaction transaction,
                                               boolean successful,
                                               InvocationContext ctx)
        Description copied from interface: CacheNotifier
        Notifies all registered listeners of a transaction completion event.
        Specified by:
        notifyTransactionCompleted in interface CacheNotifier<K,​V>
        Parameters:
        transaction - the transaction that has just completed
        successful - if true, the transaction committed. If false, this is a rollback event
      • notifyClusterListeners

        public void notifyClusterListeners​(java.util.Collection<? extends CacheEntryEvent<K,​V>> events,
                                           java.util.UUID uuid)
        Description copied from interface: ClusterCacheNotifier
        Method that is invoked on the node that has the given cluster listener that when registered generated the given listenerId. Note this will notify only cluster listeners and regular listeners are not notified of the events. Will fire the events in the order of the iteration of the collection.
        Specified by:
        notifyClusterListeners in interface ClusterCacheNotifier<K,​V>
      • retrieveClusterListenerCallablesToInstall

        public java.util.Collection<DistributedCallable> retrieveClusterListenerCallablesToInstall()
        Description copied from interface: ClusterCacheNotifier
        This method is invoked so that this node can send the details required for a new node to be bootstrapped with the existing cluster listeners that are already installed.
        Specified by:
        retrieveClusterListenerCallablesToInstall in interface ClusterCacheNotifier<K,​V>
        Returns:
        A collection of callables that should be invoked on the new node to properly install cluster listener information
      • isNotificationAllowed

        public boolean isNotificationAllowed​(org.infinispan.commands.FlagAffectedCommand cmd,
                                             java.util.List<CacheEntryListenerInvocation<K,​V>> listeners)
      • addListener

        public void addListener​(java.lang.Object listener)
        Description copied from interface: Listenable
        Adds a listener to the component. Typically, listeners would need to be annotated with Listener and further to that, contain methods annotated appropriately, otherwise the listener will not be registered.

        See the Listener annotation for more information.

        Specified by:
        addListener in interface Listenable
        Parameters:
        listener - must not be null.
      • addListener

        public void addListener​(java.lang.Object listener,
                                KeyFilter<? super K> filter,
                                java.lang.ClassLoader classLoader)
        Description copied from interface: ClassLoaderAwareFilteringListenable
        Adds a listener to the component. Typically, listeners would need to be annotated with Listener and further to that, contain methods annotated appropriately, otherwise the listener will not be registered.

        See the Listener annotation for more information.

        Specified by:
        addListener in interface ClassLoaderAwareFilteringListenable<K,​V>
        Parameters:
        listener - must not be null.
        classLoader - class loader
      • addListener

        public <C> void addListener​(java.lang.Object listener,
                                    CacheEventFilter<? super K,​? super V> filter,
                                    CacheEventConverter<? super K,​? super V,​C> converter,
                                    java.lang.ClassLoader classLoader)
        Adds the listener using the provided filter converter and class loader. The provided builder is used to add additional configuration including (clustered, onlyPrimary & identifier) which can be used after this method is completed to see what values were used in the addition of this listener
        Specified by:
        addListener in interface ClassLoaderAwareFilteringListenable<K,​V>
        Type Parameters:
        C -
        Parameters:
        listener -
        filter -
        converter -
        classLoader -
      • getListenerCollectionForAnnotation

        public java.util.List<CacheEntryListenerInvocation<K,​V>> getListenerCollectionForAnnotation​(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
        Overrides:
        getListenerCollectionForAnnotation in class org.infinispan.notifications.impl.AbstractListenerImpl<Event<K,​V>,​CacheEntryListenerInvocation<K,​V>>
      • addListener

        public void addListener​(java.lang.Object listener,
                                KeyFilter<? super K> filter)
        Description copied from interface: FilteringListenable
        Adds a listener to the component. Typically, listeners would need to be annotated with Listener and further to that, contain methods annotated appropriately, otherwise the listener will not be registered.

        See the Listener annotation for more information.

        Specified by:
        addListener in interface FilteringListenable<K,​V>
        Parameters:
        listener - must not be null.
      • addListener

        public <C> void addListener​(java.lang.Object listener,
                                    CacheEventFilter<? super K,​? super V> filter,
                                    CacheEventConverter<? super K,​? super V,​C> converter)
        Description copied from interface: FilteringListenable
        Registers a listener that will be notified on events that pass the filter condition. The value presented in the notifications will be first converted using the provided converter if there is one.

        Some implementations may provide optimizations when a CacheEventFilterConverter is provided as both arguments to the filter and converter arguments. Note the provided object must have reference equality ie. (==) to be recognized. This allows for the filter and conversion step to take place in the same method call reducing possible overhead.

        Specified by:
        addListener in interface FilteringListenable<K,​V>
        Type Parameters:
        C - The type of the resultant value after being converted
        Parameters:
        listener - The listener to callback upon event notifications. Must not be null.
        filter - The filter to see if the notification should be sent to the listener. Can be null.
        converter - The converter to apply to the entry before being sent to the listener. Can be null.
      • addFilteredListener

        public <C> void addFilteredListener​(java.lang.Object listener,
                                            CacheEventFilter<? super K,​? super V> filter,
                                            CacheEventConverter<? super K,​? super V,​C> converter,
                                            java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> filterAnnotations)
        Description copied from interface: FilteringListenable
        Registers a listener limiting the cache-entry specific events only to annotations that are passed in as parameter.

        For example, if the listener passed in contains callbacks for CacheEntryCreated and CacheEntryModified, and filtered annotations contains only CacheEntryCreated, then the listener will be registered only for CacheEntryCreated callbacks.

        Callback filtering only applies to CacheEntryCreated, CacheEntryModified, CacheEntryRemoved and CacheEntryExpired annotations. If the listener contains other annotations, these are preserved.

        This methods enables dynamic registration of listener interests at runtime without the need to create several different listener classes.

        Specified by:
        addFilteredListener in interface FilteringListenable<K,​V>
        Type Parameters:
        C - The type of the resultant value after being converted
        Parameters:
        listener - The listener to callback upon event notifications. Must not be null.
        filter - The filter to see if the notification should be sent to the listener. Can be null.
        converter - The converter to apply to the entry before being sent to the listener. Can be null.
        filterAnnotations - cache-entry annotations to allow listener to be registered on. Must not be null.
      • removeListener

        public void removeListener​(java.lang.Object listener)
        Description copied from interface: Listenable
        Removes a listener from the component.
        Specified by:
        removeListener in interface Listenable
        Overrides:
        removeListener in class org.infinispan.notifications.impl.AbstractListenerImpl<Event<K,​V>,​CacheEntryListenerInvocation<K,​V>>
        Parameters:
        listener - listener to remove. Must not be null.
      • removeListenerInvocation

        protected java.util.Set<CacheEntryListenerInvocation<K,​V>> removeListenerInvocation​(java.lang.Class<? extends java.lang.annotation.Annotation> annotation,
                                                                                                  java.lang.Object listener)
        Overrides:
        removeListenerInvocation in class org.infinispan.notifications.impl.AbstractListenerImpl<Event<K,​V>,​CacheEntryListenerInvocation<K,​V>>