Skip to content

Releases: kasapdev/java-retry

v1.3.0

Choose a tag to compare

@kasapdev kasapdev released this 20 Sep 08:01
ec27706

Added

  • Retry.withMaxDelay(Duration) - caps every backoff delay (applied after the
    multiplier and jitter). Without a cap the delay grows unboundedly and, for a
    large multiplier or many attempts, multiplier^n overflows to an endless
    wait; the cap keeps waits bounded.
  • Retry.onRetry(RetryListener) and the new RetryListener functional
    interface - called right before each retry with the 1-based failed attempt
    number, its failure and the delay about to be waited. Works for both
    execute and executeAsync; not called after the final attempt or for
    non-retryable failures. A listener that throws aborts retrying (propagated
    by execute, completes the future exceptionally for executeAsync).

v1.2.0

Choose a tag to compare

@kasapdev kasapdev released this 07 Sep 20:05

Added

  • Retry.executeAsync(Supplier<CompletableFuture<T>>): an async counterpart to the existing execute(Callable<T>), for tasks that already return a CompletableFuture<T>.
    • Applies the exact same retry policy as the synchronous path — reuses the existing exception-type matching (retryOn) and delay computation (backoff multiplier + jitter) logic rather than duplicating it.
    • Never blocks a thread while waiting between attempts: retries are scheduled via CompletableFuture.delayedExecutor(...) instead of Thread.sleep.
    • Treats a synchronous throw from the supplier itself the same as an exceptionally-completed future, and unwraps CompletionException before the retryability check so retryOn-configured types match as they would on the sync path.
    • Returns a CompletableFuture<T> that completes with the eventual result, or completes exceptionally once retries are exhausted or the failure isn't retryable.
  • New README "Async Retry" section with a runnable example, plus an additional realistic example (a reused policy across multiple calls) in "Usage".
  • New RetryTest coverage for the async path: eventual success after N failures with exact invocation-count assertions, immediate failure on a non-retryable exception, exhaustion after maxAttempts, first-try success, and a supplier that throws synchronously before returning a future — all using short (single-digit ms) configured backoff, no real multi-second waits.

Zero dependencies, pure Java 17, no build tool required — unchanged from prior releases.

v1.1.0

Choose a tag to compare

@kasapdev kasapdev released this 06 Sep 01:37

Adds edge-case regression tests: constructor/builder argument validation, explicit empty retryOn(), exception subtype matching, maxAttempts=1 semantics, and unwrapped Error propagation. No behavioral changes; all tests pass.

v1.0.0

Choose a tag to compare

@kasapdev kasapdev released this 05 Sep 23:41

Initial stable release.