Package org.apache.ignite.lang

# 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 Summary

Modifier and Type
Method
Description
`static void`
`addCancelAction(org.apache.ignite.lang.CancellationToken token, Runnable cancelAction, CompletableFuture<?> completionFut)`
Attaches a cancellable operation to the given token.
`static void`
`addCancelAction(org.apache.ignite.lang.CancellationToken token, CompletableFuture<?> completionFut)`
Attaches a future to the given token.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### addCancelAction

public static void addCancelAction(org.apache.ignite.lang.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:

- `CancelHandle.cancel()`
- `CancelHandle.cancelAsync()`

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(org.apache.ignite.lang.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.