Class TaskCancelledException
- All Implemented Interfaces:
Serializable
TaskContext.throwIfCancellationRequested().
Applications normally do not need to catch this exception. The MDI
one-shot adapter catches it and completes the task with the
CANCELLED status rather than treating cooperative cancellation as a
failure — but only when the engine's cancellation flag is actually
set at that point (i.e. this exception genuinely originated from
TaskContext.throwIfCancellationRequested() in response to a real
cancel() request). Constructing and throwing this exception
directly, without a preceding cancellation request, is not equivalent to
cooperative cancellation: the adapter finds the cancellation flag unset and
rethrows it, completing the task as FAILED instead. It is public so
task code may perform local cleanup in a catch block when
necessary; cleanup that must always run is usually better placed in a
finally block.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an exception with a stable diagnostic message. -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
TaskCancelledException
public TaskCancelledException()Creates an exception with a stable diagnostic message.
-