Class ManagedInvocationLifetime
java.lang.Object
org.j7m.middleware.application.components.ManagedInvocationLifetime
- All Implemented Interfaces:
AutoCloseable, org.j7m.middleware.transport.api.InvocationCompletionScope
public final class ManagedInvocationLifetime
extends Object
implements org.j7m.middleware.transport.api.InvocationCompletionScope
Trusted host ownership for one invocation, independent of its caller's reply future.
One serial actor shares CALL values across explicitly submitted work and codec continuations.
Arbitrary cancelled application stages retain ownership because cancellation is not exit proof.
No application-supplied future marker is consulted. Hidden work on arbitrary executors is outside
the tracked-work contract; applications should use the supplied invocation control instead.
-
Constructor Summary
ConstructorsConstructorDescriptionManagedInvocationLifetime(ManagedContainer.CallScope callScope, org.j7m.middleware.application.api.InvocationContext context, org.j7m.middleware.security.api.SecurityContext security, Duration budget, Executor executor, int maximumTasks, int maximumPending, Runnable released) Creates a retained invocation; the executor must enforce host-wide finite admission. -
Method Summary
Modifier and TypeMethodDescriptionvoidstatic booleanactive()Reports whether the host installed a physical boundary on this thread.voidaddResultFinalizer(org.j7m.middleware.transport.api.InvocationResultFinalizer finalizer) <T> Tvoidclose()<T> T<T> CompletionStage<T> continueInContext(Callable<T> action) static <T> TcurrentContext(Class<T> type) Reads an exact host-installed attachment inside the current serial CALL context.static CompletionStage<Void> Returns a read-only physical completion view for trusted host pipeline integration.static booleanReports whether the current owned context still admits application work and staged effects.<T> Optional<T> findContext(Class<T> type) void<T> voidputContext(Class<T> type, T value) voidboolean
-
Constructor Details
-
ManagedInvocationLifetime
public ManagedInvocationLifetime(ManagedContainer.CallScope callScope, org.j7m.middleware.application.api.InvocationContext context, org.j7m.middleware.security.api.SecurityContext security, Duration budget, Executor executor, int maximumTasks, int maximumPending, Runnable released) Creates a retained invocation; the executor must enforce host-wide finite admission.- Parameters:
callScope- newly opened call scope owned by this lifetimecontext- safe host-created invocation context; its control is replaced by this trackersecurity- actual authenticated security view, nullable for anonymous dispatchbudget- original remaining monotonic budget, strictly positive and at most one dayexecutor- borrowed bounded host executor, never closed by a lifetimemaximumTasks- finite total child/continuation admissions for one invocationmaximumPending- finite queued child/continuation admissionsreleased- host callback after actual call disposal, invoked once even on disposal failure
-
-
Method Details
-
active
public static boolean active()Reports whether the host installed a physical boundary on this thread. This observation exposes no mutable completion scope to application code.- Returns:
- true inside host-owned root/worker/codec context
-
currentPhysicalCompletion
Returns a read-only physical completion view for trusted host pipeline integration. Neither this view nor the application control exposes boundary exit or disposal authority.- Returns:
- read-only completion, or null outside an owned context
-
requestCancellation
public void requestCancellation()- Specified by:
requestCancellationin interfaceorg.j7m.middleware.transport.api.InvocationCompletionScope
-
physicalCompletion
- Specified by:
physicalCompletionin interfaceorg.j7m.middleware.transport.api.InvocationCompletionScope
-
logicalResult
- Specified by:
logicalResultin interfaceorg.j7m.middleware.transport.api.InvocationCompletionScope
-
call
-
supportsResultFinalizers
public boolean supportsResultFinalizers()- Specified by:
supportsResultFinalizersin interfaceorg.j7m.middleware.transport.api.InvocationCompletionScope
-
addResultFinalizer
public void addResultFinalizer(org.j7m.middleware.transport.api.InvocationResultFinalizer finalizer) - Specified by:
addResultFinalizerin interfaceorg.j7m.middleware.transport.api.InvocationCompletionScope
-
putContext
- Specified by:
putContextin interfaceorg.j7m.middleware.transport.api.InvocationCompletionScope
-
context
- Specified by:
contextin interfaceorg.j7m.middleware.transport.api.InvocationCompletionScope
-
findContext
-
currentContext
Reads an exact host-installed attachment inside the current serial CALL context. This read-only bridge supports existing named resource providers without exposing installation or completion authority to application code.- Type Parameters:
T- attachment type- Parameters:
type- exact trusted attachment key- Returns:
- current invocation's attachment
- Throws:
IllegalStateException- outside owned context or when the key is absentNullPointerException- for a null type
-
currentUserWorkOpen
public static boolean currentUserWorkOpen()Reports whether the current owned context still admits application work and staged effects. Host finalizers and codecs may read attachments after settlement but cannot add USER work. This observation grants neither context installation nor physical-completion authority.- Returns:
- false outside an owned context or after the atomic USER seal
-
markApplicationEntry
public void markApplicationEntry()- Specified by:
markApplicationEntryin interfaceorg.j7m.middleware.transport.api.InvocationCompletionScope
-
continueInContext
- Specified by:
continueInContextin interfaceorg.j7m.middleware.transport.api.InvocationCompletionScope
-
abortBeforeTarget
public void abortBeforeTarget()- Specified by:
abortBeforeTargetin interfaceorg.j7m.middleware.transport.api.InvocationCompletionScope
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceorg.j7m.middleware.transport.api.InvocationCompletionScope
-