asyncAllOf

Returns a Future that completes once every Future in the array has completed, or fails as soon as any of them fails. The combined Future only signals completion: calling get() on it returns null, so read each result from the original Futures. An empty array returns a Future that is already complete.

asyncAllOf(futures) → returns any

This function requires Adobe ColdFusion 2025 and up.  Not supported on Lucee, etc.

Argument Reference

futures array
Required

An array of Future objects, such as those returned by runAsync().

Examples
Sample code invoking the asyncAllOf function

Waits for both tasks, then reads each result from its own Future.

a = runAsync(function(){ return 1; });
b = runAsync(function(){ return 2; });
asyncAllOf([a, b]).get();
writeOutput(a.get() + b.get());

Expected Result: 3

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub