Class ManagedDependencyBreaker

java.lang.Object
org.j7m.middleware.application.components.ManagedDependencyBreaker
All Implemented Interfaces:
AutoCloseable, org.j7m.middleware.application.api.ClientCallInterceptor

public final class ManagedDependencyBreaker extends Object implements org.j7m.middleware.application.api.ClientCallInterceptor, AutoCloseable
Host-owned tenant dependency registry surviving target refresh. Only connect/OPEN failures count. The breaker wraps the optional retry delegate, counting at most one failed logical call. OPEN rejection never enters retry. HALF_OPEN uses bounded readonly probes, never business health calls. Instances own no worker threads; each tenant must receive its own explicitly scoped registry.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Observable host state; these states do not claim whether a remote business effect completed.
    static final record 
    Immutable host diagnostic snapshot, with no application arguments or principal data.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ManagedDependencyBreaker(String tenantNamespace, Map<String, org.j7m.middleware.application.api.CircuitBreakerProfile> profiles)
    Creates an isolated tenant registry with one attempt per logical call.
    ManagedDependencyBreaker(String tenantNamespace, Map<String, org.j7m.middleware.application.api.CircuitBreakerProfile> profiles, org.j7m.middleware.application.api.ClientCallInterceptor delegate)
    Creates a breaker outside the given retry/dependency delegate.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Rejects new calls; existing readonly probes retain their accounting until actual exit.
    invoke(org.j7m.middleware.application.api.ClientCall call, org.j7m.middleware.application.api.ClientAttempt attempt)
    status(String policy)
    Returns a bounded dependency diagnostic without creating state for unknown names.
    void
    validate(Class<?> contract)

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ManagedDependencyBreaker

      public ManagedDependencyBreaker(String tenantNamespace, Map<String, org.j7m.middleware.application.api.CircuitBreakerProfile> profiles)
      Creates an isolated tenant registry with one attempt per logical call.
      Parameters:
      tenantNamespace - explicit trusted tenant namespace, never inferred from application arguments
      profiles - at most64 fixed dependency policy names
    • ManagedDependencyBreaker

      public ManagedDependencyBreaker(String tenantNamespace, Map<String, org.j7m.middleware.application.api.CircuitBreakerProfile> profiles, org.j7m.middleware.application.api.ClientCallInterceptor delegate)
      Creates a breaker outside the given retry/dependency delegate.
      Parameters:
      tenantNamespace - explicit trusted tenant scope; separate instances isolate tenants
      profiles - finite immutable host registry
      delegate - inner interceptor, normally ManagedClientRetry; never called while OPEN
  • Method Details

    • validate

      public void validate(Class<?> contract)
      Specified by:
      validate in interface org.j7m.middleware.application.api.ClientCallInterceptor
    • invoke

      public Object invoke(org.j7m.middleware.application.api.ClientCall call, org.j7m.middleware.application.api.ClientAttempt attempt) throws Throwable
      Specified by:
      invoke in interface org.j7m.middleware.application.api.ClientCallInterceptor
      Throws:
      Throwable
    • status

      public ManagedDependencyBreaker.Status status(String policy)
      Returns a bounded dependency diagnostic without creating state for unknown names.
      Parameters:
      policy - registered name
      Returns:
      immutable state
    • close

      public void close()
      Rejects new calls; existing readonly probes retain their accounting until actual exit.
      Specified by:
      close in interface AutoCloseable