For the complete documentation index, see llms.txt. This page is also available as Markdown.

FutureNew

Create a new BoxFuture object.

Method Signature

FutureNew(value=[any], executor=[any])

Arguments

Argument
Type
Required
Description
Default

value

any

false

If passed, the value to set on the BoxFuture object as completed or it can be a lambda/closure that will provide the value and it will be executed asynchronously, or it can be a native Java CompletableFuture

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 object.

Examples

Create a new future for async execution

future = futureNew( () => 42 );
writeOutput( future.get() );

Result: 42

Create a completed future with a value

future = futureNew( "already done" );
writeOutput( future.isDone() & "," & future.get() );

Result: true,already done

Create an incomplete future and complete it later

Result: later

Last updated

Was this helpful?