Package org.infinispan.notifications
Interface Listenable
- All Known Subinterfaces:
AdvancedCache<K,,V> Cache<K,,V> CacheManagerNotifier,CacheNotifier<K,,V> ClassLoaderAwareFilteringListenable<K,,V> ClassLoaderAwareListenable,ClusterCacheNotifier<K,,V> DataConversionAwareListenable<K,,V> EmbeddedCacheManager,FilteringListenable<K,,V> SecureCache<K,V>
- All Known Implementing Classes:
AbstractDelegatingAdvancedCache,AbstractDelegatingCache,AbstractDelegatingEmbeddedCacheManager,CacheImpl,CacheManagerNotifierImpl,CacheNotifierImpl,DecoratedCache,DefaultCacheManager,EncoderCache,SecureCacheImpl,SimpleCacheImpl,StatsCollectingCache
public interface Listenable
Interface that denotes that the implementation can have listeners attached to it.
- Since:
- 4.0
- Author:
- Manik Surtani
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidaddListener(Object listener) Adds a listener to the component.addListenerAsync(Object listener) Asynchronous version ofaddListener(Object)Deprecated, for removal: This API element is subject to removal in a future version.Since 10.0, with no replacementdefault voidremoveListener(Object listener) Removes a listener from the component.removeListenerAsync(Object listener) Asynchronous version ofremoveListener(Object)
-
Method Details
-
addListener
Adds a listener to the component. Typically, listeners would need to be annotated withListenerand further to that, contain methods annotated appropriately, otherwise the listener will not be registered. See theListenerannotation for more information.- Parameters:
listener- listener to add, must not be null
-
addListenerAsync
Asynchronous version ofaddListener(Object)- Parameters:
listener- listener to add, must not be null- Returns:
- CompletionStage that when complete the listener is fully installed
-
removeListener
Removes a listener from the component.- Parameters:
listener- listener to remove. Must not be null.- Throws:
IllegalLifecycleStateException- may be thrown if theListenableis stopped.
-
removeListenerAsync
Asynchronous version ofremoveListener(Object)- Parameters:
listener- listener to remove, must not be null- Returns:
- CompletionStage that when complete the listener is fully removed
-
getListeners
Deprecated, for removal: This API element is subject to removal in a future version.Since 10.0, with no replacement- Returns:
- a set of all listeners registered on this component.
-