Interface CancelCheck
- All Known Subinterfaces:
CancellationPoint
- All Known Implementing Classes:
DefaultCancellationPoint,DelegatingCancellationPoint,DummyCancellationPoint,TimeoutCancelCheck
public interface CancelCheck
A check that can be used to determine if a process has been cancelled.
- Author:
- Simon Gratzer
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidcheck()Check if cancellation point is valid; It throws an exception in case if the cancellation point has been canceled.default voidchecks for cancellationand passes the error to the handler if cancelled.Returns null if the process has not been cancelled, otherwise the cancellation cause (if set).booleandefault <T extends Exception>
voidthrowIfCancelled(Function<String, T> theThrower)
-
Field Details
-
DUMMY
-
-
Method Details
-
check
void check()Check if cancellation point is valid; It throws an exception in case if the cancellation point has been canceled. -
check
checks for cancellationand passes the error to the handler if cancelled. The exception is then re-thrown.- Parameters:
handler- exception handler
-
isCancelled
boolean isCancelled()- Returns:
- true if point has been cancelled, false otherwise;
-
getCancellationMessage
Returns null if the process has not been cancelled, otherwise the cancellation cause (if set). -
throwIfCancelled
- Throws:
T
-