Encapsulates the notion of a Promise, a Future-like interface designed to easy integration of asynchronous functions
| Type | Name and description |
|---|---|
Promise<T> |
accept(T value)Assigns a value to an unfulfilled promise |
T |
get()Retrieves the result, blocking until the value is available |
T |
get(long timeout, java.util.concurrent.TimeUnit units)Retrieves the result, blocking until the value is available or the timeout is reached |
Promise<T> |
onComplete(groovy.lang.Closure callable)Execute the given closure when the promise completes |
Promise<T> |
onError(groovy.lang.Closure callable)Execute the given closure when an error occurs |
Promise<T> |
then(groovy.lang.Closure callable)Same as #onComplete |
Assigns a value to an unfulfilled promise
value - The valueRetrieves the result, blocking until the value is available
Retrieves the result, blocking until the value is available or the timeout is reached
timeout - The timeoutunits - The timeout unitsExecute the given closure when the promise completes
Execute the given closure when an error occurs
Same as #onComplete