T - type of the parameter passed to the consumerspublic class AsyncEvent<T>
extends java.lang.Object
| Constructor and Description |
|---|
AsyncEvent() |
| Modifier and Type | Method and Description |
|---|---|
AsyncEvent<T> |
addConsumer(java.util.function.Consumer<T> consumer)
Non blocking add consumer to the event.
|
T |
await()
Wait until the event is fired.
|
T |
await(long milliseconds)
Wait until the event is fired as much as specified number of milliseconds.
|
void |
fire() |
void |
fire(T result)
Fire the event if it was not yet fired.
|
boolean |
isFired() |
T |
waitFired()
Deprecated.
|
public AsyncEvent<T> addConsumer(java.util.function.Consumer<T> consumer)
consumer - public void fire(T result)
result - to pass to consumerspublic boolean isFired()
@Deprecated public T waitFired() throws java.lang.InterruptedException
fire(Object) call. Same as await()fire(Object)java.lang.InterruptedExceptionpublic T await() throws java.lang.InterruptedException
fire(Object) call.fire(Object)java.lang.InterruptedExceptionpublic T await(long milliseconds) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException
fire(Object) call. Throws TimeoutException if the event is
not fired in time.milliseconds - maximum number of milliseconds to wait for the event to be fired. 0 value waits forever.fire(Object)java.lang.InterruptedExceptionjava.util.concurrent.TimeoutException - if the event was not fired during the specified timepublic final void fire()