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 Details

  • 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