Class ThreadInterruptingCancellable
java.lang.Object
io.servicetalk.concurrent.internal.ThreadInterruptingCancellable
- All Implemented Interfaces:
Cancellable
A
Cancellable that will interrupt a thread.
It is important that setDone() (or setDone(Throwable)) is called on the interrupted
thread after the associated blocking operation completes to avoid "spurious" thread interrupts.
-
Field Summary
Fields inherited from interface io.servicetalk.concurrent.Cancellable
IGNORE_CANCEL -
Constructor Summary
ConstructorsConstructorDescriptionThreadInterruptingCancellable(Thread threadToInterrupt) Create a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()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.voidsetDone()Indicates the operation associated with thisCancellableis done and future calls tocancel()should be NOOPs.voidIndicates the operation associated with thisCancellableis done and future calls tocancel()should be NOOPs.
-
Constructor Details
-
Method Details
-
cancel
public 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
-
setDone
public void setDone()Indicates the operation associated with thisCancellableis done and future calls tocancel()should be NOOPs. -
setDone
Indicates the operation associated with thisCancellableis done and future calls tocancel()should be NOOPs.- Parameters:
cause- The operation failed, and this is theThrowablethat indicates why. If this isInterruptedExceptionthenThread.interrupted()will be called for the current thread to clear the interrupt status.
-