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 void
addCancelAction
(CancellationToken token, Runnable cancelAction, CompletableFuture<?> completionFut) Attaches a cancellable operation to the given token.static void
addCancelAction
(CancellationToken token, CompletableFuture<?> completionFut) Attaches a future to the given token.static boolean
isCancelled
(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 whencompletionFut
completes.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 forcompletionFut
to 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 whencompletionFut
completes.- 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:
True
if a cancellation was previously requested,false
otherwise.
-