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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordWhole-host JVM heap ceiling, verified against Runtime.maxMemory.static final recordOne host-local shared admission profile.Nested classes/interfaces inherited from interface ManagedInvocationPolicy
ManagedInvocationPolicy.Binding, ManagedInvocationPolicy.Phase, ManagedInvocationPolicy.Proceed -
Constructor Summary
ConstructorsConstructorDescriptionManagedResourcePolicy(Map<String, ManagedResourcePolicy.ResourceProfile> resources, Map<String, ManagedResourcePolicy.HostHeapProfile> isolation) Creates an immutable registry of host-enforced profiles. -
Method Summary
Modifier and TypeMethodDescriptionSet<Class<? extends Annotation>> Declares exactly which annotation behaviors this implementation enforces.bind(org.j7m.middleware.application.api.ManagedServiceContract contract, Class<?> implementation, Class<?> businessInterface) Prepares bounded per-export policy state after all contracts validate, before constructors.voidclose()Stops future/queued admission without cancelling running methods or closing borrowed host services.phase()Returns the fixed trusted host ordering phase.Returns aggregate host-local admission counters for a registered profile.voidvalidate(org.j7m.middleware.application.api.ManagedServiceContract contract, Class<?> implementation, Class<?> businessInterface) Validates a complete export contract without executing application code.voidvalidateComponent(Class<?> component, boolean exported) Validates every finite component before any application constructor runs.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ManagedInvocationPolicy
bindHosted, validateExposure, validateHosted, validateHostedExposure, validateHostedExposure
-
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 profilesisolation- at most 64 named whole-host JVM heap profiles- Throws:
IllegalArgumentException- for invalid identifiers or excessive profilesNullPointerException- for null maps/members
-
-
Method Details
-
phase
Returns the fixed trusted host ordering phase.- Specified by:
phasein interfaceManagedInvocationPolicy- Returns:
- application phase by default for source compatibility
-
annotationTypes
Declares exactly which annotation behaviors this implementation enforces.- Specified by:
annotationTypesin interfaceManagedInvocationPolicy- Returns:
- immutable finite capability set; an empty set permits a host-wide observer
-
validateComponent
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:
validateComponentin interfaceManagedInvocationPolicy- Parameters:
component- declared component/product typeexported- 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:
validatein interfaceManagedInvocationPolicy- Parameters:
contract- verified contract ID/version and complete method signatureimplementation- concrete application implementationbusinessInterface- 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:
bindin interfaceManagedInvocationPolicy- Parameters:
contract- verified complete method identityimplementation- concrete application implementationbusinessInterface- manifest-declared business interface- Returns:
- owned policy state
-
status
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:
closein interfaceAutoCloseable
-