Class CancelHandleHelper

java.lang.Object
org.apache.ignite.lang.CancelHandleHelper

public final class CancelHandleHelper extends Object
Utility class to provide direct access to internals of CancelHandleImpl.
  • 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 when completionFut 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 for completionFut 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

      public static void addCancelAction(CancellationToken token, CompletableFuture<?> completionFut)
      Attaches a future to the given token. A cancellation procedure call CompletableFuture.cancel(boolean) and handle completes when completionFut completes.
      Parameters:
      token - Cancellation token.
      completionFut - Future that completes when operation completes and all resources it created are released.
    • isCancelled

      public static boolean isCancelled(CancellationToken token)
      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.