Class ManagedContainer.CallScope
java.lang.Object
org.j7m.middleware.application.components.ManagedContainer.CallScope
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
ManagedContainer
Explicit call ownership boundary, shared neither implicitly nor through captured providers.
A scope may move between threads serially but concurrent use is rejected. Closing a running
scope is rejected rather than reporting false completion. Returned raw values must not be
used after their owning scope closes.
-
Method Summary
Modifier and TypeMethodDescription<T> TRuns code with this explicit call visible to providers; restores prior thread state.voidclose()Disposes owned call values once in reverse creation order; borrowed values remain live.<T> Tget(Class<T> type, String name, List<org.j7m.middleware.application.api.ManagedQualifier> qualifiers) Resolves a product within this call's ownership, making providers available during creation.retain()Retains this call across idle asynchronous handoffs.
-
Method Details
-
get
public <T> T get(Class<T> type, String name, List<org.j7m.middleware.application.api.ManagedQualifier> qualifiers) Resolves a product within this call's ownership, making providers available during creation.- Type Parameters:
T- requested contract- Parameters:
type- required contractname- exact namequalifiers- exact qualifiers- Returns:
- call/activation/prototype product
- Throws:
IllegalStateException- for closed/concurrent use or failed resolution
-
call
Runs code with this explicit call visible to providers; restores prior thread state. No new thread or async continuation inherits this scope automatically.- Type Parameters:
T- result type- Parameters:
work- synchronous caller-owned work- Returns:
- work result
- Throws:
Exception- the work's exception; callback failures do not imply an external undoIllegalStateException- for invalid scope ownership
-
retain
Retains this call across idle asynchronous handoffs. A retained scope cannot be disposed. The host closes the token only after actual workers and context finally blocks have exited.- Returns:
- idempotent ownership token
- Throws:
IllegalStateException- when closed or the container's per-call retention capacity is full
-
close
public void close()Disposes owned call values once in reverse creation order; borrowed values remain live.- Specified by:
closein interfaceAutoCloseable- Throws:
IllegalStateException- if running or if any disposer fails; remaining disposers still run
-