Failure and cancellation
Latest stable Based on Leader release 0.4.0
Separate ordinary contention, action failure, backend failure, cancellation, and ownership loss.
Five outcomes
Section titled “Five outcomes”Contention returns skipped. Action exceptions propagate from nullable APIs or appear as ActionFailed in result APIs. Backend acquire failures are infrastructure errors and are not disguised as contention. Cancellation propagates. Lease extension can additionally report NotHeld, WrongThread, or BackendError.
Caller policy
Section titled “Caller policy”Count skipped separately from failed. Retry a backend error only after classifying it and checking whether the action may already have started. Never retry an action failure blindly. On NotHeld, stop or fence remaining external writes because another contender may acquire ownership.
Shutdown
Section titled “Shutdown”Stop scheduling new attempts, cancel scoped coroutine jobs, wait for bounded in-flight work, then close the elector’s backend client according to its ownership contract. Framework integrations help bind this sequence to application lifecycle, but the application still owns the action’s cancellation safety.
Release sources
Section titled “Release sources”leader-core/src/main/kotlin/io/bluetape4k/leader/LeaderRunResult.ktleader-core/src/main/kotlin/io/bluetape4k/leader/ExtendOutcome.ktleader-core/src/test/kotlin/io/bluetape4k/leader/LeaderRunResultTest.kt