An interface capable of creating Promise instances. The Promises static methods use this interface to create promises. The default Promise creation mechanism can be overriden by setting Promises.setPromiseFactory
Type | Name and description |
---|---|
void |
addPromiseDecoratorLookupStrategy(PromiseDecoratorLookupStrategy lookupStrategy) Adds a PromiseDecoratorLookupStrategy. |
groovy.lang.Closure<T> |
applyDecorators(groovy.lang.Closure<T> c, java.util.List<PromiseDecorator> decorators) Applies the registered decorators to the given closure |
Promise<T> |
createBoundPromise(T value) Creates a promise with a value pre-bound to it |
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 |
Promise<java.util.List<T>> |
createPromise(Promise<T>... promises) Creates a promise from one or more other promises |
Promise<T> |
createPromise(groovy.lang.Closure<T>... c) Creates a promise from one or many closures |
Promise<T> |
createPromise(groovy.lang.Closure<T> c, java.util.List<PromiseDecorator> decorators) Creates a promise from one or many closures |
Promise<java.util.List<T>> |
createPromise(java.util.List<groovy.lang.Closure<T>> closures, java.util.List<PromiseDecorator> decorators) Creates a promise from one or many closures |
Promise<java.util.List<T>> |
createPromise(java.util.List<groovy.lang.Closure<T>> closures) Creates a promise from one or many closures |
Promise<java.util.List<T>> |
onComplete(java.util.List<Promise<T>> promises, groovy.lang.Closure<?> callable) Executes the given callback when the list of promises completes |
Promise<java.util.List<T>> |
onError(java.util.List<Promise<T>> promises, groovy.lang.Closure<?> callable) Executes the given callback if an error occurs for the list of promises |
java.util.List<T> |
waitAll(Promise<T>... promises) Synchronously waits for all promises to complete returning a list of values |
java.util.List<T> |
waitAll(java.util.List<Promise<T>> promises) Synchronously waits for all promises to complete returning a list of values |
java.util.List<T> |
waitAll(java.util.List<Promise<T>> promises, long timeout, java.util.concurrent.TimeUnit units) Synchronously waits for all promises to complete returning a list of values |
Adds a PromiseDecoratorLookupStrategy. The strategy implementation must be stateless, do not add a strategy that contains state
lookupStrategy
- The lookup strategyApplies the registered decorators to the given closure
c
- The closuredecorators
- The decoratorsCreates a promise with a value pre-bound to it
value
- The value
- The type of the valueCreates a promise from the given map where the values of the map are either closures or Promise instances
map
- The mapCreates a promise from one or more other promises
promises
- The promisesCreates a promise from one or many closures
c
- One or many closuresCreates a promise from one or many closures
c
- One or many closuresCreates a promise from one or many closures
closures
- One or many closuresCreates a promise from one or many closures
closures
- One or many closuresExecutes the given callback when the list of promises completes
promises
- The promisescallable
- The callback to executeExecutes the given callback if an error occurs for the list of promises
promises
- The promises The promisescallable
- The error callback to executeSynchronously waits for all promises to complete returning a list of values
promises
- The promisesSynchronously waits for all promises to complete returning a list of values
promises
- The promisesSynchronously waits for all promises to complete returning a list of values
promises
- The promises