H - the handler typepublic class MultiHandlerManager<H> extends Object
| Modifier and Type | Field and Description |
|---|---|
protected CopyOnWriteArrayList<hu.akarnokd.rxjava3.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(@NonNull Consumer<H> consumer)
The given consumer is invoked with each registered handler instance.
|
<S> void |
forEach(S state,
@NonNull 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.
|
@NonNull Disposable |
register(H handler)
Registers the specified handler instance with this MultiHandlerManager.
|
protected final CopyOnWriteArrayList<hu.akarnokd.rxjava3.debug.multihook.MultiHandlerManager.HandlerRegistration<H>> handlers
public MultiHandlerManager()
@NonNull public final @NonNull 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 @NonNull 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
@NonNull 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.