← ClaudeAtlas

cancellation-and-interruptionlisted

Designing cooperative cancellation in Java across interruption, Future/CompletableFuture, executor/scope shutdown, deadlines, resource close/abort, CPU loops, blocking APIs, native calls, partial side effects and cleanup. Covers multiple cancellation sources, signal ownership, propagation/translation/restoration, noninterruptible regions, residual work, idempotency and bounded termination tests. Use when timeout/cancel returns but work or resources remain, or when `InterruptedException` handling is ambiguous. Timeout selection and retry policy are separate.
robsonkades/agent-skills · ★ 2 · Code & Development · score 75
Install: claude install-skill robsonkades/agent-skills
# Cancellation and interruption ## Purpose Make abandonment observable and bounded across the whole work graph. Interruption is one cooperative signal; resource close, protocol abort, cancellation tokens, deadlines and process isolation may be needed. Returning a timeout/cancelled result while work continues is a semantic and capacity state, not necessarily successful cancellation. The authoring/API reference baseline is JDK 25; inspect the target project's compiler release/toolchain, deployed runtime, thread type and client/provider versions before selecting a mechanism. Virtual threads require JDK 21+ for final support; structured concurrency in JDK 25 is preview and requires that release's preview compilation/runtime configuration. Do not upgrade Java, enable preview or replace the client merely to apply this skill. Use `structured-concurrency` for the exact scope API and `timeouts-and-deadlines` for budget selection. If ownership or provider semantics are unknown, identify the missing evidence and propose a bounded control experiment; do not claim a stop guarantee from the API name. ## Cancellation contract ```text work owner and terminal states: sources: caller, deadline, sibling failure, shutdown, overload, admin winner/precedence when sources race: signal per execution/blocking/resource layer: observation/check points and maximum cancellation latency: downstream propagation and residual work: partial side effects, commit point, compensation/idempotency: resource c