public class AsyncDispatch<T> extends Object implements StoppableDispatch<T>, AsyncStoppable
A Dispatch implementation which delivers messages asynchronously. Calls to
dispatch(T) queue the message. Worker threads deliver the messages in the order they have been received to one
of a pool of delegate Dispatch instances.
| Constructor and Description |
|---|
AsyncDispatch(Executor executor) |
AsyncDispatch(Executor executor,
Dispatch<? super T> dispatch) |
AsyncDispatch(Executor executor,
Dispatch<? super T> dispatch,
int maxQueueSize) |
| Modifier and Type | Method and Description |
|---|---|
void |
dispatch(T message)
Dispatches the next message.
|
void |
dispatchTo(Dispatch<? super T> dispatch)
Starts dispatching messages to the given handler.
|
void |
requestStop()
Commences a shutdown of this dispatch.
|
void |
stop()
Stops accepting new messages, and blocks until all queued messages have been dispatched.
|
public AsyncDispatch(Executor executor)
public void dispatchTo(Dispatch<? super T> dispatch)
public void dispatch(T message)
Dispatchpublic void requestStop()
requestStop in interface AsyncStoppablepublic void stop()
stop in interface Stoppablestop in interface StoppableDispatch<T>Copyright © 2013. All rights reserved