Class IdempotencyResolver

java.lang.Object
com.tnsai.idempotency.IdempotencyResolver

public final class IdempotencyResolver extends Object
Orchestrates a single tool / action call under Idempotent protection (issue #91): derives the key, consults the IdempotencyStore, decides between returning the cached outcome and re-running the call body, then writes the new outcome back to the store on a cache miss.

The resolver is the wiring layer that connects the primitives shipped in PR #108 (IdempotencyKey, IdempotencyStore, IdempotencyEntry) to a real call site. Call sites (ToolMethodDispatcher today; the action executor in a follow-up) hand the resolver an Idempotent annotation, the tool / action identifier, the argument map, the optional IdempotencyKeySupplier for the KeyStrategy.EXPLICIT path, and a Callable that runs the underlying body. The resolver does not know or care what the body does.

Cache-hit semantics

Decided by Idempotent.onCacheHit():

Failure caching

Off by default (Idempotent.cacheFailures()). When on, the resolver caches a failure entry after a body throw, then re-throws the original. Subsequent retries see the cached failure and apply the onCacheHit policy.

Concurrency

Best-effort dedup, not single-flight: two parallel calls with the same key both miss the cache, both run, and the later writer wins. Acceptable for the primary use case (sequential retries of one call) and matches the InMemoryIdempotencyStore's lazy-eviction model. Strict single-flight (collapse parallel calls to one execution) is reserved for a future store-side primitive.
Since:
0.8.6 (issue #91 — wiring follow-up to PR #108)