CompletableJob

interface CompletableJob : Job

A job that can be completed using complete() function. It is returned by Job() and SupervisorJob() constructor functions.

All functions on this interface are thread-safe and can be safely invoked from concurrent coroutines without external synchronization.

The CompletableJob interface is not stable for inheritance in 3rd party libraries, as new methods might be added to this interface in the future, but is stable for use.

Functions

complete
Link copied to clipboard
abstract fun complete(): Boolean

Completes this job. The result is true if this job was completed as a result of this invocation and false otherwise (if it was already completed).

completeExceptionally
Link copied to clipboard
abstract fun completeExceptionally(exception: Throwable): Boolean

Completes this job exceptionally with a given exception. The result is true if this job was completed as a result of this invocation and false otherwise (if it was already completed). exception parameter is used as an additional debug information that is not handled by any exception handlers.

Sources

common source
Link copied to clipboard