Interface CancelHandle


public interface CancelHandle
A handle which may be used to request the cancellation of execution.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Abruptly terminates an execution of an associated process.
    Abruptly terminates an execution of a associated process.
    A factory method to create a handle.
    boolean
    Flag indicating whether cancellation was requested or not.
    Issue a token associated with this handle.
  • Method Details

    • create

      static CancelHandle create()
      A factory method to create a handle.
    • cancel

      void cancel()
      Abruptly terminates an execution of an associated process.

      Control flow will return after the process has been terminated and the resources associated with that process have been freed.

    • cancelAsync

      CompletableFuture<Void> cancelAsync()
      Abruptly terminates an execution of a associated process.
      Returns:
      A future that will be completed after the process has been terminated and the resources associated with that process have been freed.
    • isCancelled

      boolean isCancelled()
      Flag indicating whether cancellation was requested or not.

      This method will return true even if cancellation has not been completed yet.

      Returns:
      true when cancellation was requested.
    • token

      Issue a token associated with this handle.

      Token is reusable, meaning the same token may be used to link several executions into a single cancellable.