future
Starts a new coroutine and returns its result as an implementation of CompletableFuture. The running coroutine is cancelled when the resulting future is cancelled or otherwise completed.
The coroutine context is inherited from a CoroutineScope, additional context elements can be specified with the context argument. If the context does not have any dispatcher nor any other ContinuationInterceptor, then Dispatchers.Default is used. The parent job is inherited from a CoroutineScope as well, but it can also be overridden with corresponding context element.
By default, the coroutine is immediately scheduled for execution. Other options can be specified via start
parameter. See CoroutineStart for details. A value of CoroutineStart.LAZY is not supported (since CompletableFuture
framework does not provide the corresponding capability) and produces IllegalArgumentException.
See newCoroutineContext for a description of debugging facilities that are available for newly created coroutine.
Parameters
additional to CoroutineScope.coroutineContext context of the coroutine.
coroutine start option. The default value is CoroutineStart.DEFAULT.
the coroutine code.