Interface CancelCheck
-
- All Known Subinterfaces:
CancellationPoint
- All Known Implementing Classes:
DefaultCancellationPoint,DelegatingCancellationPoint,DummyCancellationPoint,TimeoutCancelCheck
public interface CancelCheck
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.RunnableDO_NOT_CLOSEstatic CancelCheckDUMMY
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidcheck()Check if cancellation point is valid; It throws an exception in case if the cancellation point has been canceled.default voidcheck(java.util.function.Consumer<java.lang.Exception> handler)Check if cancellation point is valid, and handle the exception if it's not.java.lang.StringgetCancellationMessage()Returns null if the process has not been cancelled, otherwise the cancellation cause (if set).booleanisCancelled()default <T extends java.lang.Exception>
voidthrowIfCancelled(java.util.function.Function<java.lang.String,T> theThrower)
-
-
-
Field Detail
-
DO_NOT_CLOSE
static final java.lang.Runnable DO_NOT_CLOSE
-
DUMMY
static final CancelCheck DUMMY
-
-
Method Detail
-
check
void check()
Check if cancellation point is valid; It throws an exception in case if the cancellation point has been canceled.
-
check
default void check(java.util.function.Consumer<java.lang.Exception> handler)
Check if cancellation point is valid, and handle the exception if it's not.- Parameters:
handler- exception handler
-
isCancelled
boolean isCancelled()
- Returns:
- true if point has been cancelled, false otherwise;
-
getCancellationMessage
@Nullable java.lang.String getCancellationMessage()
Returns null if the process has not been cancelled, otherwise the cancellation cause (if set).
-
throwIfCancelled
default <T extends java.lang.Exception> void throwIfCancelled(java.util.function.Function<java.lang.String,T> theThrower) throws T extends java.lang.Exception- Throws:
T extends java.lang.Exception
-
-