public class JobKt
Modifier and Type | Method and Description |
---|---|
static Job |
Job(Job parent)
Creates a new job object in an active state.
It is optionally a child of a parent job.
|
static boolean |
cancel(kotlin.coroutines.experimental.CoroutineContext $receiver,
java.lang.Throwable cause)
Cancels
interface Job of this context with an optional cancellation cause. The result is true if the job was
cancelled as a result of this invocation and false if there is no job in the context or if it was already
cancelled or completed. See Job.cancel for details. |
static java.lang.Object |
cancelAndJoin(Job $receiver,
kotlin.coroutines.experimental.Continuation<? super kotlin.Unit> $continuation)
Cancels the job and suspends invoking coroutine until the cancelled job is complete.
|
static void |
cancelChildren(Job $receiver,
java.lang.Throwable cause)
Cancels all children jobs of this coroutine with the given cause using cancel
for all of them. Unlike cancel on this job as a whole, the state of this job itself is not affected.
|
static void |
cancelChildren(kotlin.coroutines.experimental.CoroutineContext $receiver,
java.lang.Throwable cause)
Cancels all children of the
interface Job in this context with an optional cancellation cause.
It does not do anything if there is no job in the context or it has no children.
See Job.cancelChildren for details. |
static DisposableHandle |
cancelFutureOnCompletion(Job $receiver,
java.util.concurrent.Future<?> future)
Cancels a specified future when this job is complete.
|
static DisposableHandle |
disposeOnCompletion(Job $receiver,
DisposableHandle handle)
Disposes a specified handle when this job is complete.
|
static java.lang.Object |
joinChildren(Job $receiver,
kotlin.coroutines.experimental.Continuation<? super kotlin.Unit> $continuation)
Suspends coroutine until all children of this job are complete using
join for all of them. Unlike join on this job as a whole, it does not wait until
this job is complete.
|
public static Job Job(Job parent)
Creates a new job object in an active state. It is optionally a child of a parent job.
public static DisposableHandle disposeOnCompletion(Job $receiver, DisposableHandle handle)
Disposes a specified handle when this job is complete.
This is a shortcut for the following code with slightly more efficient implementation (one fewer object created).
invokeOnCompletion { handle.dispose() }
public static DisposableHandle cancelFutureOnCompletion(Job $receiver, java.util.concurrent.Future<?> future)
Cancels a specified future when this job is complete.
This is a shortcut for the following code with slightly more efficient implementation (one fewer object created).
invokeOnCompletion { future.cancel(false) }
public static java.lang.Object cancelAndJoin(Job $receiver, kotlin.coroutines.experimental.Continuation<? super kotlin.Unit> $continuation)
Cancels the job and suspends invoking coroutine until the cancelled job is complete.
This suspending function is cancellable and always checks for the cancellation of invoking coroutine's Job.
If the interface Job
of the invoking coroutine is cancelled or completed when this
suspending function is invoked or while it is suspended, this function
throws CancellationException.
In particular, it means that a parent coroutine invoking cancelAndJoin
on a child coroutine that was started using
launch(coroutineContext) { ... }
builder throws CancellationException if the child
had crashed, unless a non-standard interface CoroutineExceptionHandler
if installed in the context.
This is a shortcut for the invocation of cancel followed by join.
interface Job
,
interface CoroutineExceptionHandler
public static void cancelChildren(Job $receiver, java.lang.Throwable cause)
Cancels all children jobs of this coroutine with the given cause using cancel for all of them. Unlike cancel on this job as a whole, the state of this job itself is not affected.
public static java.lang.Object joinChildren(Job $receiver, kotlin.coroutines.experimental.Continuation<? super kotlin.Unit> $continuation)
Suspends coroutine until all children of this job are complete using join for all of them. Unlike join on this job as a whole, it does not wait until this job is complete.
public static boolean cancel(kotlin.coroutines.experimental.CoroutineContext $receiver, java.lang.Throwable cause)
Cancels interface Job
of this context with an optional cancellation cause. The result is true
if the job was
cancelled as a result of this invocation and false
if there is no job in the context or if it was already
cancelled or completed. See Job.cancel for details.
interface Job
public static void cancelChildren(kotlin.coroutines.experimental.CoroutineContext $receiver, java.lang.Throwable cause)
Cancels all children of the interface Job
in this context with an optional cancellation cause.
It does not do anything if there is no job in the context or it has no children.
See Job.cancelChildren for details.
interface Job