Whatever message this page gives is out now! Go check it out!

acceptEitherAsync (Future method)

Last update:
May 18, 2026
When either this Future or another completes successfully first, runs an action with that value on the async executor.

Description

acceptEitherAsync is the side-effect form of applyToEitherAsync. Your action receives the winning result but does not return a replacement value from the API perspective.

Returns

A new Future.

Category

Asynchronous programming

Function syntax

future.acceptEitherAsync(other, action)

Parameters

ParameterDescription
otherRequired. The other Future to race.
actionRequired. A function that takes the first completed value and performs an action (void return).

See also

Example

Capture the winning value (from product tests).

<cfscript>
    f1 = runAsync(function() { return "winner"; });
    f2 = runAsync(function() {    sleep(1000);    return "loser";});
    either = f1.acceptEitherAsync(f2, function(x) {    variables.winner = x;});
    either.get();
    writeOutput(variables.winner); // winner
</cfscript>
      

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page