AsyncAll
This BIF accepts an array of futures/closures/lambdas and executes them all in parallel.
It returns a BoxFuture that will contain an array of results once all futures are completed successfully.
This means that the futures will be executed in parallel and the results will be returned in the order that they were passed in. This also means that this operation is non-blocking and will return immediately until you call get() on the future.
Each future can be a BoxFuture or a CompletableFuture or a BoxLang Function that will be treated as a future.
results = all( [f1, f2, f3] ).get()
all( [f1, f2, f3] ).then( (values) => logResults( values ) );
Method Signature
AsyncAll(futures=[array], executor=[any])
Arguments
futures
array
true
An array of BoxFuture objects to process in parallel
executor
any
false
The executor to use for the BoxFuture object. By default, the BoxFuture object will use the default executor (ForkJoinPool.commonPool()). This can be the name of a named executor or a custom executor record.
Examples
Related
Last updated
Was this helpful?