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 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
ConstructorDescriptionThreadInterruptingCancellable
(Thread threadToInterrupt) Create a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.void
setDone()
Indicates the operation associated with thisCancellable
is done and future calls tocancel()
should be NOOPs.void
Indicates the operation associated with thisCancellable
is done and future calls tocancel()
should be NOOPs.
-
Constructor Details
-
Method Details
-
cancel
public 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
-
setDone
public void setDone()Indicates the operation associated with thisCancellable
is done and future calls tocancel()
should be NOOPs. -
setDone
Indicates the operation associated with thisCancellable
is done and future calls tocancel()
should be NOOPs.- Parameters:
cause
- The operation failed, and this is theThrowable
that indicates why. If this isInterruptedException
thenThread.interrupted()
will be called for the current thread to clear the interrupt status.
-