Interface CancellationScope
- All Superinterfaces:
Runnable
- All Known Subinterfaces:
WorkflowThread
- All Known Implementing Classes:
RootWorkflowThreadImpl
Handle to a cancellation scope created through
Workflow.newCancellationScope(Runnable) or
Workflow.newDetachedCancellationScope(Runnable). Supports explicit cancelling of the code
a cancellation scope wraps. The code in the CancellationScope has to be executed using Runnable.run() method.-
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Cancels the scope as well as all its childrenvoidCancels the scope as well as all its children.static CancellationScopecurrent()Use this promise to perform cancellation of async operations.booleanIs scope was asked to cancel throughcancel()or by a parent scope.booleanWhen set to false parent thread cancellation causes this one to get canceled automatically.static voidThrowsCanceledFailureif scope is canceled.
-
Method Details
-
isDetached
boolean isDetached()When set to false parent thread cancellation causes this one to get canceled automatically. When set to true only call tocancel()leads to this scope cancellation. -
cancel
void cancel()Cancels the scope as well as all its children -
cancel
Cancels the scope as well as all its children.- Parameters:
reason- human-readable reason for the cancellation. Becomes message of the CanceledException thrown.
-
getCancellationReason
String getCancellationReason() -
isCancelRequested
boolean isCancelRequested()Is scope was asked to cancel throughcancel()or by a parent scope.- Returns:
- whether request is canceled or not.
-
getCancellationRequest
-
current
-
throwCanceled
ThrowsCanceledFailureif scope is canceled. Noop if not canceled.- Throws:
CanceledFailure
-