public class TestCancellable extends java.lang.Object implements Cancellable
Cancellable
that tracks cancellation.IGNORE_CANCEL
Constructor and Description |
---|
TestCancellable() |
Modifier and Type | Method and Description |
---|---|
void |
awaitCancelled()
Wait until
cancel() is called. |
void |
awaitCancelledUninterruptibly()
Wait until
cancel() is called without being interrupted. |
void |
cancel()
Sends a hint to the producer of the associated asynchronous execution that the consumer related to this
Cancellable is not interested in the outcome of the execution. |
boolean |
isCancelled()
|
public final void cancel()
Cancellable
Cancellable
is not interested in the outcome of the execution.cancel
in interface Cancellable
public final boolean isCancelled()
true
if cancel()
has been called, false
otherwise.public final void awaitCancelled() throws java.lang.InterruptedException
cancel()
is called.java.lang.InterruptedException
- If this thread is interrupted while waiting.public final void awaitCancelledUninterruptibly()
cancel()
is called without being interrupted. This method catches an
InterruptedException
and discards it silently.