public interface PromiseFactory
Promise instances. The Promises static methods use this
interface to create promises. The default Promise creation mechanism can be overriden by setting Promises.setPromiseFactory(PromiseFactory)| Modifier and Type | Method and Description |
|---|---|
void |
addPromiseDecoratorLookupStrategy(org.grails.async.decorator.PromiseDecoratorLookupStrategy lookupStrategy)
Adds a PromiseDecoratorLookupStrategy.
|
<T> groovy.lang.Closure<T> |
applyDecorators(groovy.lang.Closure<T> c,
java.util.List<org.grails.async.decorator.PromiseDecorator> decorators)
Applies the registered decorators to the given closure
|
<T> grails.async.Promise<T> |
createBoundPromise(T value)
Creates a promise with a value pre-bound to it
|
<T> grails.async.Promise<T> |
createPromise(groovy.lang.Closure<T>... c)
Creates a promise from one or many closures
|
<T> grails.async.Promise<T> |
createPromise(groovy.lang.Closure<T> c,
java.util.List<org.grails.async.decorator.PromiseDecorator> decorators)
Creates a promise from one or many closures
|
<T> grails.async.Promise<java.util.List<T>> |
createPromise(java.util.List<groovy.lang.Closure<T>> closures)
Creates a promise from one or many closures
|
<T> grails.async.Promise<java.util.List<T>> |
createPromise(java.util.List<groovy.lang.Closure<T>> closures,
java.util.List<org.grails.async.decorator.PromiseDecorator> decorators)
Creates a promise from one or many closures
|
<K,V> grails.async.Promise<java.util.Map<K,V>> |
createPromise(java.util.Map<K,V> map)
Creates a promise from the given map where the values of the map are either closures or Promise instances
|
<T> grails.async.Promise<java.util.List<T>> |
createPromise(grails.async.Promise<T>... promises)
Creates a promise from one or more other promises
|
<T> grails.async.Promise<java.util.List<T>> |
onComplete(java.util.List<grails.async.Promise<T>> promises,
groovy.lang.Closure<?> callable)
Executes the given callback when the list of promises completes
|
<T> grails.async.Promise<java.util.List<T>> |
onError(java.util.List<grails.async.Promise<T>> promises,
groovy.lang.Closure<?> callable)
Executes the given callback if an error occurs for the list of promises
|
<T> java.util.List<T> |
waitAll(java.util.List<grails.async.Promise<T>> promises)
Synchronously waits for all promises to complete returning a list of values
|
<T> java.util.List<T> |
waitAll(java.util.List<grails.async.Promise<T>> promises,
long timeout,
java.util.concurrent.TimeUnit units)
Synchronously waits for all promises to complete returning a list of values
|
<T> java.util.List<T> |
waitAll(grails.async.Promise<T>... promises)
Synchronously waits for all promises to complete returning a list of values
|
void addPromiseDecoratorLookupStrategy(org.grails.async.decorator.PromiseDecoratorLookupStrategy lookupStrategy)
lookupStrategy - The lookup strategy<T> groovy.lang.Closure<T> applyDecorators(groovy.lang.Closure<T> c,
java.util.List<org.grails.async.decorator.PromiseDecorator> decorators)
c - The closuredecorators - The decorators<T> grails.async.Promise<T> createBoundPromise(T value)
T - The type of the valuevalue - The value<K,V> grails.async.Promise<java.util.Map<K,V>> createPromise(java.util.Map<K,V> map)
map - The map<T> grails.async.Promise<java.util.List<T>> createPromise(grails.async.Promise<T>... promises)
promises - The promises<T> grails.async.Promise<T> createPromise(groovy.lang.Closure<T>... c)
c - One or many closures<T> grails.async.Promise<T> createPromise(groovy.lang.Closure<T> c,
java.util.List<org.grails.async.decorator.PromiseDecorator> decorators)
c - One or many closures<T> grails.async.Promise<java.util.List<T>> createPromise(java.util.List<groovy.lang.Closure<T>> closures,
java.util.List<org.grails.async.decorator.PromiseDecorator> decorators)
closures - One or many closures<T> grails.async.Promise<java.util.List<T>> createPromise(java.util.List<groovy.lang.Closure<T>> closures)
closures - One or many closures<T> java.util.List<T> waitAll(grails.async.Promise<T>... promises)
promises - The promises<T> java.util.List<T> waitAll(java.util.List<grails.async.Promise<T>> promises)
promises - The promises<T> java.util.List<T> waitAll(java.util.List<grails.async.Promise<T>> promises,
long timeout,
java.util.concurrent.TimeUnit units)
promises - The promises<T> grails.async.Promise<java.util.List<T>> onComplete(java.util.List<grails.async.Promise<T>> promises,
groovy.lang.Closure<?> callable)
promises - The promisescallable - The callback to execute<T> grails.async.Promise<java.util.List<T>> onError(java.util.List<grails.async.Promise<T>> promises,
groovy.lang.Closure<?> callable)
promises - The promises The promisescallable - The error callback to execute