Class StandardListenerManager<T>
- java.lang.Object
-
- org.apache.curator.framework.listen.StandardListenerManager<T>
-
- All Implemented Interfaces:
Listenable<T>,ListenerManager<T,T>,UnaryListenerManager<T>
public class StandardListenerManager<T> extends java.lang.Object implements UnaryListenerManager<T>
Non mapping version of a listener container
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(T listener)Add the given listener.voidaddListener(T listener, java.util.concurrent.Executor executor)Add the given listener.voidclear()Remove all listenersvoidforEach(java.util.function.Consumer<T> function)Utility - apply the given function to each listener.static <T> StandardListenerManager<T>mappingStandard(java.util.function.UnaryOperator<T> mapper)Returns a new mapping container that maps to the same typevoidremoveListener(T listener)Remove the given listenerintsize()Return the number of listenersstatic <T> StandardListenerManager<T>standard()Returns a new standard listener container-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.curator.framework.listen.ListenerManager
isEmpty
-
-
-
-
Method Detail
-
standard
public static <T> StandardListenerManager<T> standard()
Returns a new standard listener container- Returns:
- new container
-
mappingStandard
public static <T> StandardListenerManager<T> mappingStandard(java.util.function.UnaryOperator<T> mapper)
Returns a new mapping container that maps to the same type- Parameters:
mapper- listener mapper/wrapper- Returns:
- new container
-
addListener
public void addListener(T listener)
Description copied from interface:ListenableAdd the given listener. The listener will be executed in the containing instance's thread.- Specified by:
addListenerin interfaceListenable<T>- Parameters:
listener- listener to add
-
addListener
public void addListener(T listener, java.util.concurrent.Executor executor)
Description copied from interface:ListenableAdd the given listener. The listener will be executed using the given executor- Specified by:
addListenerin interfaceListenable<T>- Parameters:
listener- listener to addexecutor- executor to run listener in
-
removeListener
public void removeListener(T listener)
Description copied from interface:ListenableRemove the given listener- Specified by:
removeListenerin interfaceListenable<T>- Parameters:
listener- listener to remove
-
clear
public void clear()
Description copied from interface:ListenerManagerRemove all listeners- Specified by:
clearin interfaceListenerManager<T,T>
-
size
public int size()
Description copied from interface:ListenerManagerReturn the number of listeners- Specified by:
sizein interfaceListenerManager<T,T>- Returns:
- number
-
forEach
public void forEach(java.util.function.Consumer<T> function)
Description copied from interface:ListenerManagerUtility - apply the given function to each listener. The function receives the listener as an argument.- Specified by:
forEachin interfaceListenerManager<T,T>- Parameters:
function- function to call for each listener
-
-