Interface ActivityCancellationToken
Token that allows an Activity implementation to observe cancellation requests.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionFuture that completes exceptionally withActivityCanceledExceptionwhen cancellation has been requested for this Activity Execution.booleanReturns true after cancellation has been requested for this Activity Execution.voidThrowsActivityCanceledExceptionif cancellation has been requested for this Activity Execution.
-
Field Details
-
NONE
-
-
Method Details
-
isCancellationRequested
boolean isCancellationRequested()Returns true after cancellation has been requested for this Activity Execution.If this method returns true, the Activity implementation should stop its work and usually call
throwIfCancellationRequested()to report successful cancellation to Temporal. -
throwIfCancellationRequested
ThrowsActivityCanceledExceptionif cancellation has been requested for this Activity Execution.Rethrowing this exception from Activity code reports successful cancellation to Temporal.
- Throws:
ActivityCanceledException
-
getCancellationFuture
CompletableFuture<Void> getCancellationFuture()Future that completes exceptionally withActivityCanceledExceptionwhen cancellation has been requested for this Activity Execution.Activity code should still call
throwIfCancellationRequested()or otherwise report cancellation if it wants the Activity Execution to complete as canceled.
-