public final class DispatchingEStage extends Object implements AutoCloseable
| Constructor and Description |
|---|
DispatchingEStage(DispatchingEStage other)
Constructs a DispatchingEStage that uses the Thread pool and ErrorHandler of another one.
|
DispatchingEStage(EventHandler<Throwable> errorHandler,
int numThreads,
String stageName) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the stage adn stop accepting new messages.
|
boolean |
isClosed()
Check if the stage can still accept messages.
|
boolean |
isEmpty()
Return true if there are no messages queued or in processing, false otherwise.
|
<T,U extends T> |
onNext(Class<T> type,
U message)
Dispatch a new message by type.
|
<T,U extends T> |
register(Class<T> type,
Set<EventHandler<U>> handlers)
Register a new event handler.
|
public DispatchingEStage(EventHandler<Throwable> errorHandler, int numThreads, String stageName)
errorHandler - used for exceptions thrown from the event handlers registered.numThreads - number of threads to allocate to dispatch events.stageName - the name to use for the underlying stage.
It will be carried over to name the Thread(s) spawned.public DispatchingEStage(DispatchingEStage other)
other - public <T,U extends T> void register(Class<T> type, Set<EventHandler<U>> handlers)
T - Message type.U - Type of message that event handler supports. Must be a subclass of T.type - Message type to process with this handler.handlers - A set of handlers that process that type of message.public <T,U extends T> void onNext(Class<T> type, U message)
T - Message type that event handler supports.U - input message type. Must be a subclass of T.type - Type of event handler - must match the register() call.message - A message to process. Must be a subclass of T.public boolean isEmpty()
public void close()
close in interface AutoCloseablepublic boolean isClosed()
Copyright © 2017 The Apache Software Foundation. All rights reserved.