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> p)
Cancels the job and suspends invoking coroutine until the cancelled job is complete.
|
static void |
cancelChildren(Job $receiver,
java.lang.Throwable cause)
Cancels all
Job.getChildren jobs of this coroutine with the given cause using Job.cancel
for all of them. Unlike Job.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> p)
Suspends coroutine until all
Job.getChildren of this job are complete using
Job.join for all of them. Unlike Job.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> p)
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 Job.cancel followed by Job.join.
public static void cancelChildren(Job $receiver, java.lang.Throwable cause)
Cancels all Job.getChildren jobs of this coroutine with the given cause using Job.cancel
for all of them. Unlike Job.cancel on this job as a whole, the state of this job itself is not affected.
Job.getChildren,
Job.cancel,
Job.cancelpublic static java.lang.Object joinChildren(Job $receiver, kotlin.coroutines.experimental.Continuation<? super kotlin.Unit> p)
Suspends coroutine until all Job.getChildren of this job are complete using
Job.join for all of them. Unlike Job.join on this job as a whole, it does not wait until
this job is complete.
Job.getChildren,
Job.join,
Job.joinpublic 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,
Job.cancelpublic 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