H - the handler typepublic class MultiHandlerManager<H>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.util.concurrent.CopyOnWriteArrayList<hu.akarnokd.rxjava2.debug.multihook.MultiHandlerManager.HandlerRegistration<H>> |
handlers
The copy-on-write registry of handlers wrapped into a HandlerRegistration container
to support disposing/unregistering a particular registration.
|
| Constructor and Description |
|---|
MultiHandlerManager()
Constructs an empty handler manager.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Removes all handlers from this MultiHandlerManager.
|
void |
forEach(io.reactivex.functions.Consumer<H> consumer)
The given consumer is invoked with each registered handler instance.
|
<S> void |
forEach(S state,
io.reactivex.functions.BiConsumer<S,H> consumer)
The given consumer is invoked with each registered handler instance.
|
boolean |
hasHandlers()
Returns true if this manager has any handlers registered.
|
io.reactivex.disposables.Disposable |
register(H handler)
Registers the specified handler instance with this MultiHandlerManager.
|
protected final java.util.concurrent.CopyOnWriteArrayList<hu.akarnokd.rxjava2.debug.multihook.MultiHandlerManager.HandlerRegistration<H>> handlers
public MultiHandlerManager()
@NonNull
public final io.reactivex.disposables.Disposable register(@NonNull
H handler)
Handlers don't have to be unique instances, if the same handler is registered multiple times, it will be invoked multiple times as well.
This method is threadsafe.
handler - the handler to registerpublic final void forEach(@NonNull
io.reactivex.functions.Consumer<H> consumer)
Exceptions raised by the invocation of the consumer for a particular handler are printed to the console and the current thread's uncaught exception handler is notified.
This method is threadsafe.
consumer - the consumer to invokepublic final <S> void forEach(S state,
@NonNull
io.reactivex.functions.BiConsumer<S,H> consumer)
Exceptions raised by the invocation of the consumer for a particular handler are printed to the console and the current thread's uncaught exception handler is notified.
This method is threadsafe.
S - the type of the extra state provided to the consumerstate - the extra state provided to the consumerconsumer - the consumer to invokepublic final void clear()
This method is threadsafe.
public final boolean hasHandlers()
This method is threadsafe.