Package org.infinispan.notifications
Interface FilteringListenable<K,V>
-
- All Superinterfaces:
Listenable
- All Known Subinterfaces:
AdvancedCache<K,V>
,Cache<K,V>
,CacheNotifier<K,V>
,ClassLoaderAwareFilteringListenable<K,V>
,ClusterCacheNotifier<K,V>
,DataConversionAwareListenable<K,V>
,SecureCache<K,V>
- All Known Implementing Classes:
CacheNotifierImpl
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 Deprecated Methods Modifier and Type Method Description default <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)
Registers a listener limiting the cache-entry specific events only to annotations that are passed in as parameter.<C> java.util.concurrent.CompletionStage<java.lang.Void>
addFilteredListenerAsync(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)
Asynchronous version ofaddFilteredListener(Object, CacheEventFilter, CacheEventConverter, Set)
void
addListener(java.lang.Object listener, KeyFilter<? super K> filter)
Deprecated.Method uses KeyFilter and is no longer supporteddefault <C> void
addListener(java.lang.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> java.util.concurrent.CompletionStage<java.lang.Void>
addListenerAsync(java.lang.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(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)
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> java.util.concurrent.CompletionStage<java.lang.Void>
addStorageFormatFilteredListenerAsync(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)
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(java.lang.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:
java.lang.NullPointerException
- if the specified listener is null
-
addListener
@Deprecated void addListener(java.lang.Object listener, KeyFilter<? super K> filter)
Deprecated.Method uses KeyFilter and is no longer supportedAdds a listener to the component. Typically, listeners would need to be annotated withListener
and further to that, contain methods annotated appropriately, otherwise the listener will not be registered. See theListener
annotation for more information.- Parameters:
listener
- must not be null.
-
addListenerAsync
<C> java.util.concurrent.CompletionStage<java.lang.Void> addListenerAsync(java.lang.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(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)
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> java.util.concurrent.CompletionStage<java.lang.Void> addFilteredListenerAsync(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)
Asynchronous version ofaddFilteredListener(Object, CacheEventFilter, CacheEventConverter, Set)
- Type Parameters:
C
-- Parameters:
listener
- listener to add, must not be nullfilter
-converter
-filterAnnotations
-- Returns:
- CompletionStage that when complete the listener is fully installed
-
addStorageFormatFilteredListener
default <C> void addStorageFormatFilteredListener(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)
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> java.util.concurrent.CompletionStage<java.lang.Void> addStorageFormatFilteredListenerAsync(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)
Asynchronous version ofaddStorageFormatFilteredListener(Object, CacheEventFilter, CacheEventConverter, Set)
- Type Parameters:
C
-- Parameters:
listener
- listener to add, must not be nullfilter
-converter
-filterAnnotations
-- Returns:
- CompletionStage that when complete the listener is fully installed
-
-