Class ManagedContainer.CallScope

java.lang.Object
org.j7m.middleware.application.components.ManagedContainer.CallScope
All Implemented Interfaces:
AutoCloseable
Enclosing class:
ManagedContainer

public final class ManagedContainer.CallScope extends Object implements AutoCloseable
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 Type
    Method
    Description
    <T> T
    call(Callable<T> work)
    Runs code with this explicit call visible to providers; restores prior thread state.
    void
    Disposes owned call values once in reverse creation order; borrowed values remain live.
    <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.
    Retains this call across idle asynchronous handoffs.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 contract
      name - exact name
      qualifiers - exact qualifiers
      Returns:
      call/activation/prototype product
      Throws:
      IllegalStateException - for closed/concurrent use or failed resolution
    • call

      public <T> T call(Callable<T> work) throws Exception
      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 undo
      IllegalStateException - for invalid scope ownership
    • retain

      public AutoCloseable 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:
      close in interface AutoCloseable
      Throws:
      IllegalStateException - if running or if any disposer fails; remaining disposers still run