public class NonCancellable implements Job
A non-cancelable job that is always NonCancellable.isActive. It is designed for BuildersKt.withContext function
to prevent cancellation of code blocks that need to be executed without cancellation.
Use it like this:
withContext(NonCancellable) {
// this code will not be cancelled
}
NonCancellable.isActive,
BuildersKt.withContextJob.DefaultImpls, Job.Key| Modifier and Type | Field and Description |
|---|---|
static NonCancellable |
INSTANCE
A non-cancelable job that is always
NonCancellable.isActive. It is designed for BuildersKt.withContext function
to prevent cancellation of code blocks that need to be executed without cancellation. |
| Modifier and Type | Method and Description |
|---|---|
DisposableHandle |
attachChild(Job child)
Always returns
class NonDisposableHandle and does not do anything. |
boolean |
cancel(java.lang.Throwable cause)
Always returns
false. |
java.util.concurrent.CancellationException |
getCancellationException()
Always throws IllegalStateException.
|
kotlin.sequences.Sequence<kotlinx.coroutines.experimental.Job> |
getChildren()
Always returns emptySequence.
|
SelectClause0 |
getOnJoin()
Clause for select expression of
NonCancellable.join suspending function that selects when the job is complete.
This clause never fails, even if the job completes exceptionally. |
DisposableHandle |
invokeOnCompletion(kotlin.jvm.functions.Function1<? super java.lang.Throwable,kotlin.Unit> handler)
Always returns
class NonDisposableHandle. |
DisposableHandle |
invokeOnCompletion(boolean onCancelling_,
kotlin.jvm.functions.Function1<? super java.lang.Throwable,kotlin.Unit> handler)
Always returns
class NonDisposableHandle. |
DisposableHandle |
invokeOnCompletion(boolean onCancelling,
boolean invokeImmediately,
kotlin.jvm.functions.Function1<? super java.lang.Throwable,kotlin.Unit> handler)
Always returns
class NonDisposableHandle. |
boolean |
isActive()
Always returns
true. |
boolean |
isCancelled()
Always returns
false. |
boolean |
isCompleted()
Always returns
false. |
java.lang.Object |
join(kotlin.coroutines.experimental.Continuation<? super kotlin.Unit> p)
Always throws UnsupportedOperationException.
|
boolean |
start()
Always returns
false. |
cancel, getCancellationException, getChildren, getOnJoin, invokeOnCompletion, invokeOnCompletion, isActive, isCancelled, isCompleted, join, startpublic static NonCancellable INSTANCE
A non-cancelable job that is always NonCancellable.isActive. It is designed for BuildersKt.withContext function
to prevent cancellation of code blocks that need to be executed without cancellation.
Use it like this:
withContext(NonCancellable) {
// this code will not be cancelled
}
NonCancellable.isActive,
BuildersKt.withContextpublic boolean isActive()
Always returns true.
public boolean isCompleted()
Always returns false.
public boolean isCancelled()
Always returns false.
public boolean start()
Always returns false.
public java.lang.Object join(kotlin.coroutines.experimental.Continuation<? super kotlin.Unit> p)
Always throws UnsupportedOperationException.
public SelectClause0 getOnJoin()
Clause for select expression of NonCancellable.join suspending function that selects when the job is complete.
This clause never fails, even if the job completes exceptionally.
NonCancellable.joinpublic java.util.concurrent.CancellationException getCancellationException()
Always throws IllegalStateException.
public DisposableHandle invokeOnCompletion(kotlin.jvm.functions.Function1<? super java.lang.Throwable,kotlin.Unit> handler)
Always returns class NonDisposableHandle.
class NonDisposableHandlepublic DisposableHandle invokeOnCompletion(boolean onCancelling_, kotlin.jvm.functions.Function1<? super java.lang.Throwable,kotlin.Unit> handler)
Always returns class NonDisposableHandle.
class NonDisposableHandlepublic DisposableHandle invokeOnCompletion(boolean onCancelling, boolean invokeImmediately, kotlin.jvm.functions.Function1<? super java.lang.Throwable,kotlin.Unit> handler)
Always returns class NonDisposableHandle.
class NonDisposableHandlepublic boolean cancel(java.lang.Throwable cause)
Always returns false.
public kotlin.sequences.Sequence<kotlinx.coroutines.experimental.Job> getChildren()
Always returns emptySequence.
public DisposableHandle attachChild(Job child)
Always returns class NonDisposableHandle and does not do anything.
class NonDisposableHandle