Package org.apache.ignite.lang
Class CancelHandleHelper
java.lang.Object
org.apache.ignite.lang.CancelHandleHelper
Utility class to provide direct access to internals of
CancelHandleImpl.-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddCancelAction(CancellationToken token, Runnable cancelAction, CompletableFuture<?> completionFut) Attaches a cancellable operation to the given token.static voidaddCancelAction(CancellationToken token, CompletableFuture<?> completionFut) Attaches a future to the given token.static booleanisCancelled(CancellationToken token) Flag indicating whether cancellation was requested or not.
-
Method Details
-
addCancelAction
public static void addCancelAction(CancellationToken token, Runnable cancelAction, CompletableFuture<?> completionFut) Attaches a cancellable operation to the given token. A cancellation procedure started its handle completes whencompletionFutcompletes.NOTE: If a handle, this token is associated with, was cancelled or its cancellation was requested, this method immediately invokes
cancelAction.run()and it this case it never waits forcompletionFutto complete.The following methods request cancellation of a handle:
- Parameters:
token- Cancellation token.cancelAction- Action that terminates an operation.completionFut- Future that completes when operation completes and all resources it created are released.
-
addCancelAction
Attaches a future to the given token. A cancellation procedure callCompletableFuture.cancel(boolean)and handle completes whencompletionFutcompletes.- Parameters:
token- Cancellation token.completionFut- Future that completes when operation completes and all resources it created are released.
-
isCancelled
Flag indicating whether cancellation was requested or not.This method will return true even if cancellation has not been completed yet.
- Returns:
Trueif a cancellation was previously requested,falseotherwise.
-