Interface CancellationSignal

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface CancellationSignal
Provider-independent cancellation signal for streaming operations.

The signal carries no operation content, key material or executor state. Implementations should be immutable views over runtime-owned cancellation state. Streaming readers and writers are expected to call throwIfCancelled() between bounded I/O operations.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final CancellationSignal
    A signal that never requests cancellation.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Reports whether cancellation was requested.
    default void
    Fails the current streaming operation when cancellation was requested.
  • Field Details

  • Method Details

    • isCancelled

      boolean isCancelled()
      Reports whether cancellation was requested.
      Returns:
      true when the operation should stop
    • throwIfCancelled

      default void throwIfCancelled() throws InterruptedIOException
      Fails the current streaming operation when cancellation was requested.
      Throws:
      InterruptedIOException - when cancellation was requested