public class SynchronizedDispatch<T> extends Object implements Connection<T>
by Szczepan Faber, created at: 2/27/12
| Constructor and Description |
|---|
SynchronizedDispatch(Connection<T> delegate) |
| Modifier and Type | Method and Description |
|---|---|
void |
dispatch(T message)
Dispatches the next message.
|
T |
receive()
Blocks until the next message is available.
|
void |
requestStop()
Requests that this stoppable commence a graceful stop.
|
void |
stop()
Requests a graceful stop of this object.
|
String |
toString() |
public SynchronizedDispatch(Connection<T> delegate)
public void requestStop()
AsyncStoppableRequests that this stoppable commence a graceful stop. Does not block. You should call Stoppable.stop() to wait for the stop process to complete.
Generally, an AsyncStoppable should continue to complete existing work after this method has returned.
It should, however, stop accepting new work.
Requesting stopping does not guarantee the stoppable actually stops. Requesting stopping means preparing for stopping; stopping accepting new work. You have to call stop at some point anyway if your intention is to completely stop the stoppable.
requestStop in interface AsyncStoppablepublic void dispatch(T message)
Dispatchpublic T receive()
Receivepublic void stop()
StoppableRequests a graceful stop of this object. Blocks until all concurrent activity has been completed.
If this object has already been stopped, this method does nothing.
Copyright © 2013. All rights reserved