Package org.infinispan.notifications
Interface FilteringListenable<K,V>
-
- All Superinterfaces:
Listenable
- All Known Subinterfaces:
AdvancedCache<K,V>
,Cache<K,V>
,ClassLoaderAwareFilteringListenable<K,V>
,DataConversionAwareListenable<K,V>
,SecureCache<K,V>
public interface FilteringListenable<K,V> extends Listenable
A Listenable that can also filter events based on key- Since:
- 6.0
- Author:
- Manik Surtani
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <C> void
addFilteredListener(Object listener, CacheEventFilter<? super K,? super V> filter, CacheEventConverter<? super K,? super V,C> converter, Set<Class<? extends Annotation>> filterAnnotations)
Registers a listener limiting the cache-entry specific events only to annotations that are passed in as parameter.<C> CompletionStage<Void>
addFilteredListenerAsync(Object listener, CacheEventFilter<? super K,? super V> filter, CacheEventConverter<? super K,? super V,C> converter, Set<Class<? extends Annotation>> filterAnnotations)
Asynchronous version ofaddFilteredListener(Object, CacheEventFilter, CacheEventConverter, Set)
default <C> void
addListener(Object listener, CacheEventFilter<? super K,? super V> filter, CacheEventConverter<? super K,? super V,C> converter)
Registers a listener that will be notified on events that pass the filter condition.<C> CompletionStage<Void>
addListenerAsync(Object listener, CacheEventFilter<? super K,? super V> filter, CacheEventConverter<? super K,? super V,C> converter)
Asynchronous version ofaddListener(Object, CacheEventFilter, CacheEventConverter)
default <C> void
addStorageFormatFilteredListener(Object listener, CacheEventFilter<? super K,? super V> filter, CacheEventConverter<? super K,? super V,C> converter, Set<Class<? extends Annotation>> filterAnnotations)
Same asaddFilteredListener(Object, CacheEventFilter, CacheEventConverter, Set)
, but assumes the filter and/or the converter will be done in the same data format as it's stored in the cache.<C> CompletionStage<Void>
addStorageFormatFilteredListenerAsync(Object listener, CacheEventFilter<? super K,? super V> filter, CacheEventConverter<? super K,? super V,C> converter, Set<Class<? extends Annotation>> filterAnnotations)
Asynchronous version ofaddStorageFormatFilteredListener(Object, CacheEventFilter, CacheEventConverter, Set)
-
Methods inherited from interface org.infinispan.notifications.Listenable
addListener, addListenerAsync, getListeners, removeListener, removeListenerAsync
-
-
-
-
Method Detail
-
addListener
default <C> void addListener(Object listener, CacheEventFilter<? super K,? super V> filter, CacheEventConverter<? super K,? super V,C> converter)
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.- 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.- Throws:
NullPointerException
- if the specified listener is null
-
addListenerAsync
<C> CompletionStage<Void> addListenerAsync(Object listener, CacheEventFilter<? super K,? super V> filter, CacheEventConverter<? super K,? super V,C> converter)
Asynchronous version ofaddListener(Object, CacheEventFilter, CacheEventConverter)
- Type Parameters:
C
-- Parameters:
listener
- listener to add, must not be nullfilter
-converter
-- Returns:
- CompletionStage that when complete the listener is fully installed
-
addFilteredListener
default <C> void addFilteredListener(Object listener, CacheEventFilter<? super K,? super V> filter, CacheEventConverter<? super K,? super V,C> converter, Set<Class<? extends Annotation>> filterAnnotations)
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 forCacheEntryCreated
andCacheEntryModified
, and filtered annotations contains onlyCacheEntryCreated
, then the listener will be registered only forCacheEntryCreated
callbacks. Callback filtering only applies toCacheEntryCreated
,CacheEntryModified
,CacheEntryRemoved
andCacheEntryExpired
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.- 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.
-
addFilteredListenerAsync
<C> CompletionStage<Void> addFilteredListenerAsync(Object listener, CacheEventFilter<? super K,? super V> filter, CacheEventConverter<? super K,? super V,C> converter, Set<Class<? extends Annotation>> filterAnnotations)
Asynchronous version ofaddFilteredListener(Object, CacheEventFilter, CacheEventConverter, Set)
-
addStorageFormatFilteredListener
default <C> void addStorageFormatFilteredListener(Object listener, CacheEventFilter<? super K,? super V> filter, CacheEventConverter<? super K,? super V,C> converter, Set<Class<? extends Annotation>> filterAnnotations)
Same asaddFilteredListener(Object, CacheEventFilter, CacheEventConverter, Set)
, but assumes the filter and/or the converter will be done in the same data format as it's stored in the cache.
-
addStorageFormatFilteredListenerAsync
<C> CompletionStage<Void> addStorageFormatFilteredListenerAsync(Object listener, CacheEventFilter<? super K,? super V> filter, CacheEventConverter<? super K,? super V,C> converter, Set<Class<? extends Annotation>> filterAnnotations)
Asynchronous version ofaddStorageFormatFilteredListener(Object, CacheEventFilter, CacheEventConverter, Set)
-
-