|
org.codehaus.gpars | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD |
public interface Promise
A unifying future-like interface to dataflow variables, asynchronous functions and active objects.
Method Summary | |
---|---|
java.lang.Object
|
get()
Retrieves the value of the variable, blocking until a value is available |
java.lang.Object
|
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()
// * Asynchronously retrieves the value from the channel. |
void
|
join(long timeout, java.util.concurrent.TimeUnit units)
Blocks, if the value has not been assigned yet to the DataflowVariable |
Promise
|
rightShift(groovy.lang.Closure closure)
Schedule closure to be executed after data became available. |
Promise
|
then(groovy.lang.Closure closure)
Schedule closure to be executed after data became available. |
Promise
|
then(Pool pool, groovy.lang.Closure closure)
Schedule closure to be executed after data becomes available. |
Promise
|
then(PGroup group, groovy.lang.Closure closure)
Schedule closure to be executed after data becomes available. |
Promise
|
then(groovy.lang.Closure closure, groovy.lang.Closure errorHandler)
Schedule closure to be executed after data became available. |
Promise
|
then(Pool pool, groovy.lang.Closure closure, groovy.lang.Closure errorHandler)
Schedule closure to be executed after data becomes available. |
Promise
|
then(PGroup group, groovy.lang.Closure closure, groovy.lang.Closure errorHandler)
Schedule closure to be executed after data becomes available. |
void
|
whenBound(groovy.lang.Closure closure)
Schedule closure to be executed after data becomes available. |
void
|
whenBound(Pool pool, groovy.lang.Closure closure)
Schedule closure to be executed after data becomes available. |
void
|
whenBound(PGroup group, groovy.lang.Closure 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 |
Method Detail |
---|
@SuppressWarnings({"ProhibitedExceptionDeclared"}) public java.lang.Object get()
@SuppressWarnings({"ProhibitedExceptionDeclared"}) public java.lang.Object get(long timeout, java.util.concurrent.TimeUnit units)
timeout
- The timeout valueunits
- Units for the timeout
public java.lang.Throwable getError()
public boolean isBound()
public boolean isError()
public void join()
callback
- An actor to send the bound value to.
//
public void join(long timeout, java.util.concurrent.TimeUnit units)
timeout
- The timeout valueunits
- Units for the timeout
public Promise rightShift(groovy.lang.Closure closure)
closure
- closure to execute when data becomes available. The closure should take at most one argument.
public Promise then(groovy.lang.Closure closure)
closure
- closure to execute when data becomes available. The closure should take at most one argument.
public Promise then(Pool pool, groovy.lang.Closure 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.
public Promise then(PGroup group, groovy.lang.Closure 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.
public Promise then(groovy.lang.Closure closure, groovy.lang.Closure 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.
public Promise then(Pool pool, groovy.lang.Closure closure, groovy.lang.Closure 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.
public Promise then(PGroup group, groovy.lang.Closure closure, groovy.lang.Closure 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.
public void whenBound(groovy.lang.Closure closure)
closure
- closure to execute when data becomes available. The closure should take at most one argument.
public void whenBound(Pool pool, groovy.lang.Closure 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.
public void whenBound(PGroup group, groovy.lang.Closure 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.
public void whenBound(MessageStream stream)
stream
- stream where to send result
Copyright © 2008–2012 Václav Pech. All Rights Reserved.