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
ACancellable
that 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 void
awaitCancelled()
Wait untilcancel()
is called.void
awaitCancelledUninterruptibly()
Wait untilcancel()
is called without being interrupted.void
cancel()
Sends a hint to the producer of the associated asynchronous execution that the consumer related to thisCancellable
is not interested in the outcome of the execution.boolean
isCancelled()
-
-
-
Method Detail
-
cancel
public final void cancel()
Description copied from interface:Cancellable
Sends a hint to the producer of the associated asynchronous execution that the consumer related to thisCancellable
is not interested in the outcome of the execution.- Specified by:
cancel
in interfaceCancellable
-
isCancelled
public final boolean isCancelled()
- Returns:
true
ifcancel()
has been called,false
otherwise.
-
awaitCancelled
public final void awaitCancelled() throws java.lang.InterruptedException
Wait 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 anInterruptedException
and discards it silently.
-
-