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.
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
FieldsModifier and TypeFieldDescriptionstatic final CancellationSignalA signal that never requests cancellation. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReports whether cancellation was requested.default voidFails the current streaming operation when cancellation was requested.
-
Field Details
-
NONE
A signal that never requests cancellation.
-
-
Method Details
-
isCancelled
boolean isCancelled()Reports whether cancellation was requested.- Returns:
truewhen the operation should stop
-
throwIfCancelled
Fails the current streaming operation when cancellation was requested.- Throws:
InterruptedIOException- when cancellation was requested
-