Class ManagedResourcePolicy

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

public final class ManagedResourcePolicy extends Object implements ManagedInvocationPolicy, AutoCloseable
Host-installed named resource admission and explicit JVM heap capability policy.

Profiles are shared within this factory's host JVM, not coordinated across a cluster. Admission enforces concurrency, queue capacity, relative priority and bounded wait. Heap profiles validate the actual whole-process JVM heap ceiling; they neither create per-application memory quotas nor claim OS/filesystem/native-code isolation. Unknown profiles and unsupported asynchronous entries are rejected before component construction. Host setup owns this factory and closes it only after its exported applications drain. Permission and deadline policies remain separate layers.

  • Constructor Details

    • ManagedResourcePolicy

      public ManagedResourcePolicy(Map<String, ManagedResourcePolicy.ResourceProfile> resources, Map<String, ManagedResourcePolicy.HostHeapProfile> isolation)
      Creates an immutable registry of host-enforced profiles. A Priority declaration without ResourceRequirement selects the named resource profile default. Method priority overrides a type default only within the host profile's maximumPriority; contradictory method priorities or resource/isolation names are rejected.
      Parameters:
      resources - at most 64 named shared host-local admission profiles
      isolation - at most 64 named whole-host JVM heap profiles
      Throws:
      IllegalArgumentException - for invalid identifiers or excessive profiles
      NullPointerException - for null maps/members
  • 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
    • validateComponent

      public void validateComponent(Class<?> component, boolean exported)
      Validates every finite component before any application constructor runs. The default rejects claimed policy metadata on non-exported components because ordinary Java calls have no invocation boundary. A real component adapter may override this to validate and enforce its supported metadata; annotation presence never installs that adapter.
      Specified by:
      validateComponent in interface ManagedInvocationPolicy
      Parameters:
      component - declared component/product type
      exported - whether this exact type is a manifest-declared exported implementation
    • 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 profile)
      Returns aggregate host-local admission counters for a registered profile.
      Parameters:
      profile - exact trusted profile name
      Returns:
      immutable aggregate counters
      Throws:
      IllegalArgumentException - if the profile is unknown
    • close

      public void close()
      Stops future/queued admission without cancelling running methods or closing borrowed host services.
      Specified by:
      close in interface AutoCloseable