|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Promise<T>
A unifying future-like interface to dataflow variables, asynchronous functions and active objects.
Method Summary | ||
---|---|---|
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 |
|
|
rightShift(groovy.lang.Closure<V> closure)
Schedule closure to be executed after data became available. |
|
|
then(groovy.lang.Closure<V> closure)
Schedule closure to be executed after data became available. |
|
|
then(groovy.lang.Closure<V> closure,
groovy.lang.Closure<V> errorHandler)
Schedule closure to be executed after data became available. |
|
|
then(PGroup group,
groovy.lang.Closure<V> closure)
Schedule closure to be executed after data becomes available. |
|
|
then(PGroup group,
groovy.lang.Closure<V> closure,
groovy.lang.Closure<V> errorHandler)
Schedule closure to be executed after data becomes available. |
|
|
then(Pool pool,
groovy.lang.Closure<V> closure)
Schedule closure to be executed after data becomes available. |
|
|
then(Pool pool,
groovy.lang.Closure<V> closure,
groovy.lang.Closure<V> errorHandler)
Schedule closure to be executed after data becomes available. |
|
|
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 |
|
|
whenBound(PGroup group,
groovy.lang.Closure<V> closure)
Schedule closure to be executed after data becomes available. |
|
|
whenBound(Pool pool,
groovy.lang.Closure<V> closure)
Schedule closure to be executed after data becomes available. |
Method Detail |
---|
T 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 timeout
java.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 timeout
java.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.
boolean isBound()
boolean isError()
java.lang.Throwable getError()
java.lang.IllegalStateException
- If not bound or not bound to an error
|
Copyright © 2008–2012 Václav Pech. All Rights Reserved. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |