Package com.complexible.common.cancellation

# Interface CancelCheck

All Known Subinterfaces:
  `CancellationPoint`

All Known Implementing Classes:
  `DefaultCancellationPoint`, `DelegatingCancellationPoint`, `DummyCancellationPoint`, `TimeoutCancelCheck`

public interface CancelCheck
A check that can be used to determine if a process has been cancelled.

Author:
  Simon Gratzer

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final CancelCheck`
  `DUMMY`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `check()`
  Check if cancellation point is valid; It throws an exception in case if the cancellation point has been canceled.
  `default void`
  `check(Consumer<Exception> handler)`
  `checks for cancellation` and passes the error to the handler if cancelled.
  `String`
  `getCancellationMessage()`
  Returns null if the process has not been cancelled, otherwise the cancellation cause (if set).
  `boolean`
  `isCancelled()`
  `default <T extends Exception>
  void`
  `throwIfCancelled(Function<String,T> theThrower)`

- ## Field Details

  - ### DUMMY

    static final CancelCheck DUMMY

- ## Method Details

  - ### check

    void check()
    Check if cancellation point is valid; It throws an exception in case if the cancellation point has been canceled.

  - ### check

    default void check(Consumer<Exception> handler)
    `checks for cancellation` and passes the error to the handler if cancelled. The exception is then re-thrown.
    Parameters:
      `handler` - exception handler

  - ### isCancelled

    boolean isCancelled()
    Returns:
      true if point has been cancelled, false otherwise;

  - ### getCancellationMessage

    @Nullable String getCancellationMessage()
    Returns null if the process has not been cancelled, otherwise the cancellation cause (if set).

  - ### throwIfCancelled

    default <T extends Exception> void throwIfCancelled(Function<String,T> theThrower) throws T
    Throws:
      `T`