Interface ResilientValue<T>

Type Parameters:
T - type of the loaded value
All Superinterfaces:
Supplier<T>

public interface ResilientValue<T> extends Supplier<T>
A value loaded on first use using a timeout and retry protected by a circuit breaker. Each loader invocation is guarded by the timeout, the retry repeats timed attempts, and the circuit breaker wraps the complete retry batch. The timeout must execute on the current thread so a retry cannot overlap a timed-out loader that is still unwinding. The timeout interrupts the loader at its deadline; interruption-aware or independently bounded I/O is required for prompt termination. A successfully loaded value is cached permanently. Failed loads may be tried again according to the configured circuit breaker. Concurrent callers wait for the active load attempt and share its result.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    Exception indicating that a source may become available later.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> ResilientValue<T>
    Create a resilient value using the provided configuration.
    boolean
    Whether the value has already been loaded successfully.

    Methods inherited from interface Supplier

    get
  • Method Details

    • create

      static <T> ResilientValue<T> create(ResilientValueConfig<T> config)
      Create a resilient value using the provided configuration. Fault tolerance state belongs to the configured handlers; callers should supply dedicated instances when state must not be shared with other operations.
      Type Parameters:
      T - type of the loaded value
      Parameters:
      config - resilient value configuration
      Returns:
      a new resilient value
      Throws:
      IllegalArgumentException - if the timeout is not positive, exceeds the retry overall timeout, or does not execute on the current thread
    • loaded

      boolean loaded()
      Whether the value has already been loaded successfully.
      Returns:
      true if the value is loaded