public final class ThreadInterruptingCancellable extends java.lang.Object implements Cancellable
Cancellable that will interrupt a thread.
It is important that setDone() (or setDone(Throwable)) is called after the associated blocking
operation completes to avoid "spurious" thread interrupts.
IGNORE_CANCEL| Constructor and Description |
|---|
ThreadInterruptingCancellable(java.lang.Thread threadToInterrupt)
Create a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
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. |
void |
setDone()
Indicates the operation associated with this
Cancellable is done and future calls to cancel()
should be NOOPs. |
void |
setDone(java.lang.Throwable cause)
Indicates the operation associated with this
Cancellable is done and future calls to cancel()
should be NOOPs. |
public ThreadInterruptingCancellable(java.lang.Thread threadToInterrupt)
threadToInterrupt - The thread interrupt in cancel().public void cancel()
CancellableCancellable is not interested in the outcome of the execution.cancel in interface Cancellablepublic void setDone()
Cancellable is done and future calls to cancel()
should be NOOPs.public void setDone(java.lang.Throwable cause)
Cancellable is done and future calls to cancel()
should be NOOPs.cause - The operation failed, and this is the Throwable that indicates why. If this is
InterruptedException then Thread.interrupted() will be called for the current thread to clear
the interrupt status.