Class ManagedResiliencePolicy

java.lang.Object
org.j7m.middleware.application.components.ManagedResiliencePolicy
All Implemented Interfaces:
AutoCloseable, ManagedInvocationPolicy

public final class ManagedResiliencePolicy extends Object implements ManagedInvocationPolicy, AutoCloseable
Fixed tenant/dependency admission registry. Server bulkheads hold physical permits, while client connection breakers are explicitly validated against the installed client registry. Rate tokens are charged after authorization and before dependency admission, with no refund for later overload. This implementation supports LOCAL rate coordination only and never silently degrades scope.
  • Constructor Details

    • ManagedResiliencePolicy

      public ManagedResiliencePolicy(Set<String> tenants, Function<org.j7m.middleware.application.api.InvocationContext, String> tenantResolver, Map<String, org.j7m.middleware.application.api.BulkheadProfile> bulkheads, Map<String, org.j7m.middleware.application.api.RateLimitProfile> rates, ManagedDependencyBreaker breaker)
      Creates finite server admission and optional client-breaker validation. The resolver receives the actual authenticated host context; application arguments never select a tenant.
      Parameters:
      tenants - at most64 predefined tenant identities
      tenantResolver - trusted authenticated-context mapper; unknown results fail closed
      bulkheads - at most64 fixed dependency admission profiles
      rates - at most64 LOCAL fixed-window profiles
      breaker - trusted matching client registry, or null to reject CircuitBreaker declarations
  • Method Details

    • phase

      Returns the fixed trusted host ordering phase.
      Specified by:
      phase in interface ManagedInvocationPolicy
      Returns:
      application phase by default for source compatibility
    • annotationTypes

      public Set<Class<? extends Annotation>> annotationTypes()
      Declares exactly which annotation behaviors this implementation enforces.
      Specified by:
      annotationTypes in interface ManagedInvocationPolicy
      Returns:
      immutable finite capability set; an empty set permits a host-wide observer
    • validate

      public void validate(org.j7m.middleware.application.api.ManagedServiceContract contract, Class<?> implementation, Class<?> businessInterface)
      Validates a complete export contract without executing application code.
      Specified by:
      validate in interface ManagedInvocationPolicy
      Parameters:
      contract - verified contract ID/version and complete method signature
      implementation - concrete application implementation
      businessInterface - manifest-declared ordinary business interface
    • bind

      public ManagedInvocationPolicy.Binding bind(org.j7m.middleware.application.api.ManagedServiceContract contract, Class<?> implementation, Class<?> businessInterface)
      Prepares bounded per-export policy state after all contracts validate, before constructors.
      Specified by:
      bind in interface ManagedInvocationPolicy
      Parameters:
      contract - verified complete method identity
      implementation - concrete application implementation
      businessInterface - manifest-declared business interface
      Returns:
      owned policy state
    • status

      public ManagedAdmissionController.Status status(String tenant, String dependency)
      Returns actual dependency occupancy for one declared tenant, without dynamic state allocation.
      Parameters:
      tenant - declared host tenant
      dependency - registered dependency name
      Returns:
      immutable physical admission counters
    • close

      public void close()
      Rejects new/queued calls; running physical permits remain owned until their completion.
      Specified by:
      close in interface AutoCloseable