Package io.servicetalk.concurrent.api
Class TestCancellable
- java.lang.Object
-
- io.servicetalk.concurrent.api.TestCancellable
-
- All Implemented Interfaces:
Cancellable
- Direct Known Subclasses:
TestSubscription
public class TestCancellable extends java.lang.Object implements Cancellable
ACancellablethat tracks cancellation.
-
-
Field Summary
-
Fields inherited from interface io.servicetalk.concurrent.Cancellable
IGNORE_CANCEL
-
-
Constructor Summary
Constructors Constructor Description TestCancellable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidawaitCancelled()Wait untilcancel()is called.voidawaitCancelledUninterruptibly()Wait untilcancel()is called without being interrupted.voidcancel()Sends a hint to the producer of the associated asynchronous execution that the consumer related to thisCancellableis not interested in the outcome of the execution.booleanisCancelled()
-
-
-
Method Detail
-
cancel
public final void cancel()
Description copied from interface:CancellableSends a hint to the producer of the associated asynchronous execution that the consumer related to thisCancellableis not interested in the outcome of the execution.- Specified by:
cancelin interfaceCancellable
-
isCancelled
public final boolean isCancelled()
- Returns:
trueifcancel()has been called,falseotherwise.
-
awaitCancelled
public final void awaitCancelled() throws java.lang.InterruptedExceptionWait untilcancel()is called.- Throws:
java.lang.InterruptedException- If this thread is interrupted while waiting.
-
awaitCancelledUninterruptibly
public final void awaitCancelledUninterruptibly()
Wait untilcancel()is called without being interrupted. This method catches anInterruptedExceptionand discards it silently.
-
-