Architecture in Motion · Episode 020

CompletableFuture Timeouts: Why Cancelling a Future Does Not Cancel a Payment

Checkout stops waiting for a payment reply, reports failure, and invites a retry even though the provider may still complete the original request.

Illustrative failure model. No live payment, broker, database, or JVM is connected. Counts and timelines are teaching values, not benchmark results.

Check your understanding

What does orTimeout prove about the provider?

What this model does and does not prove

Separate read-only fan-out from payment effects, persist the attempt, reuse provider idempotency, and reconcile unknown outcomes.

Every step describes a constructed scenario. These states do not replace load tests, fault injection, provider contracts, JVM recordings, or durable transaction checks. Previous and Reset rebuild the teaching state; they never roll back real business operations.