public interface Promise<T> extends SelectableChannel<T>
| Modifier and Type | Method and Description |
|---|---|
T |
get()
Retrieves the value of the variable, blocking until a value is available
|
T |
get(long timeout,
java.util.concurrent.TimeUnit units)
Retrieves the value of the variable, blocking up to given timeout, if the value has not been assigned yet.
|
java.lang.Throwable |
getError()
Returns the error bound to the promise
|
boolean |
isBound()
Check if value has been set already for this expression
|
boolean |
isError()
Checks if the promise is bound to an error
|
void |
join()
Blocks, if the value has not been assigned yet to the DataflowVariable
|
void |
join(long timeout,
java.util.concurrent.TimeUnit units)
Blocks, if the value has not been assigned yet to the DataflowVariable
|
<V> Promise<V> |
rightShift(groovy.lang.Closure<V> closure)
Schedule closure to be executed after data became available.
|
<V> Promise<V> |
then(groovy.lang.Closure<V> closure)
Schedule closure to be executed after data became available.
|
<V> Promise<V> |
then(groovy.lang.Closure<V> closure,
groovy.lang.Closure<V> errorHandler)
Schedule closure to be executed after data became available.
|
<V> Promise<V> |
then(PGroup group,
groovy.lang.Closure<V> closure)
Schedule closure to be executed after data becomes available.
|
<V> Promise<V> |
then(PGroup group,
groovy.lang.Closure<V> closure,
groovy.lang.Closure<V> errorHandler)
Schedule closure to be executed after data becomes available.
|
<V> Promise<V> |
then(Pool pool,
groovy.lang.Closure<V> closure)
Schedule closure to be executed after data becomes available.
|
<V> Promise<V> |
then(Pool pool,
groovy.lang.Closure<V> closure,
groovy.lang.Closure<V> errorHandler)
Schedule closure to be executed after data becomes available.
|
Promise<java.util.List> |
thenForkAndJoin(groovy.lang.Closure<? extends java.lang.Object>... closures)
Schedule a set of closures to be executed after data became available on the current promise.
|
Promise<java.util.List> |
thenForkAndJoin(PGroup group,
groovy.lang.Closure<? extends java.lang.Object>... closures)
Schedule a set of closures to be executed after data became available on the current promise.
|
Promise<java.util.List> |
thenForkAndJoin(Pool pool,
groovy.lang.Closure<? extends java.lang.Object>... closures)
Schedule a set of closures to be executed after data became available on the current promise.
|
void |
touch()
May be used by lazy implementations to warm up
|
<V> void |
whenBound(groovy.lang.Closure<V> closure)
Schedule closure to be executed after data becomes available.
|
void |
whenBound(MessageStream stream)
Send the bound data to provided stream when it becomes available
|
<V> void |
whenBound(PGroup group,
groovy.lang.Closure<V> closure)
Schedule closure to be executed after data becomes available.
|
<V> void |
whenBound(Pool pool,
groovy.lang.Closure<V> closure)
Schedule closure to be executed after data becomes available.
|
poll, wheneverBound, wheneverBoundT get() throws java.lang.Throwable
java.lang.Throwable - If the stored value is an exception instance it gets re-thrownT get(long timeout, java.util.concurrent.TimeUnit units) throws java.lang.Throwable
timeout - The timeout valueunits - Units for the timeoutjava.lang.Throwable - If the stored value is an exception instance it gets re-thrownvoid join() throws java.lang.InterruptedException
java.lang.InterruptedException - If the current thread gets interrupted while waiting for the variable to be boundvoid join(long timeout,
java.util.concurrent.TimeUnit units)
throws java.lang.InterruptedException
timeout - The timeout valueunits - Units for the timeoutjava.lang.InterruptedException - If the current thread gets interrupted while waiting for the variable to be bound<V> Promise<V> rightShift(groovy.lang.Closure<V> closure)
closure - closure to execute when data becomes available. The closure should take at most one argument.<V> void whenBound(groovy.lang.Closure<V> closure)
closure - closure to execute when data becomes available. The closure should take at most one argument.<V> void whenBound(Pool pool, groovy.lang.Closure<V> closure)
pool - The thread pool to use for task scheduling for asynchronous message deliveryclosure - closure to execute when data becomes available. The closure should take at most one argument.<V> void whenBound(PGroup group, groovy.lang.Closure<V> closure)
group - The PGroup to use for task scheduling for asynchronous message deliveryclosure - closure to execute when data becomes available. The closure should take at most one argument.void whenBound(MessageStream stream)
stream - stream where to send result<V> Promise<V> then(groovy.lang.Closure<V> closure)
closure - closure to execute when data becomes available. The closure should take at most one argument.<V> Promise<V> then(Pool pool, groovy.lang.Closure<V> closure)
pool - The thread pool to use for task scheduling for asynchronous message deliveryclosure - closure to execute when data becomes available. The closure should take at most one argument.<V> Promise<V> then(PGroup group, groovy.lang.Closure<V> closure)
group - The PGroup to use for task scheduling for asynchronous message deliveryclosure - closure to execute when data becomes available. The closure should take at most one argument.<V> Promise<V> then(groovy.lang.Closure<V> closure, groovy.lang.Closure<V> errorHandler)
closure - closure to execute when data becomes available. The closure should take at most one argument.errorHandler - closure to execute when an error (instance of Throwable) gets bound. The closure should take at most one argument.<V> Promise<V> then(Pool pool, groovy.lang.Closure<V> closure, groovy.lang.Closure<V> errorHandler)
pool - The thread pool to use for task scheduling for asynchronous message deliveryclosure - closure to execute when data becomes available. The closure should take at most one argument.errorHandler - closure to execute when an error (instance of Throwable) gets bound. The closure should take at most one argument.<V> Promise<V> then(PGroup group, groovy.lang.Closure<V> closure, groovy.lang.Closure<V> errorHandler)
group - The PGroup to use for task scheduling for asynchronous message deliveryclosure - closure to execute when data becomes available. The closure should take at most one argument.errorHandler - closure to execute when an error (instance of Throwable) gets bound. The closure should take at most one argument.Promise<java.util.List> thenForkAndJoin(groovy.lang.Closure<? extends java.lang.Object>... closures)
closures - closure to execute when data becomes available. The closure should take at most one argument.Promise<java.util.List> thenForkAndJoin(Pool pool, groovy.lang.Closure<? extends java.lang.Object>... closures)
pool - The thread pool to use for task scheduling for asynchronous message deliveryclosures - closure to execute when data becomes available. The closure should take at most one argument.Promise<java.util.List> thenForkAndJoin(PGroup group, groovy.lang.Closure<? extends java.lang.Object>... closures)
group - The PGroup to use for task scheduling for asynchronous message deliveryclosures - closure to execute when data becomes available. The closure should take at most one argument.boolean isBound()
boolean isError()
java.lang.Throwable getError()
java.lang.IllegalStateException - If not bound or not bound to an errorvoid touch()