Interface ManagedHostedResources.Binding

All Superinterfaces:
AutoCloseable
Enclosing class:
ManagedHostedResources

public static interface ManagedHostedResources.Binding extends AutoCloseable
One owned backend lifecycle. Operations must be bounded and close must be idempotent.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Releases a fully drained or never-published resource; does not close the component.
    default void
    Commits local admission after every backend has armed successfully.
    boolean
    drain(Duration budget)
    Closes new admission and waits within the budget for actual apply/query/snapshot work.
    void
    Prepares storage and endpoints with external effect admission closed.
    void
    Arms the prepared resource after application initialization/startup has completed.
    default void
    Atomically closes new work admission without waiting or performing external I/O.
  • Method Details

    • stopAdmission

      default void stopAdmission()
      Atomically closes new work admission without waiting or performing external I/O. Called under the host's activation admission guard before asynchronous resource draining. It must be thread-safe and idempotent, including after close. The default fails closed.
      Throws:
      UnsupportedOperationException - unless this backend implements actual admission control
    • prepare

      void prepare() throws Exception
      Prepares storage and endpoints with external effect admission closed.
      Throws:
      Exception - if durable recovery or endpoint setup fails
    • start

      void start() throws Exception
      Arms the prepared resource after application initialization/startup has completed. No external application work is admitted here. Actual admission requires both the later local commitAdmission() and the host's shared all-resources admission guard.
      Throws:
      Exception - if the resource cannot safely arm
    • commitAdmission

      default void commitAdmission()
      Commits local admission after every backend has armed successfully. This must perform no external I/O or wait. A backend also honors the shared invoker admission guard, which remains closed until the host commits the entire activation.
      Throws:
      UnsupportedOperationException - unless atomic admission is implemented
    • drain

      boolean drain(Duration budget) throws Exception
      Closes new admission and waits within the budget for actual apply/query/snapshot work. A false result retains ownership and the classloader; it never authorizes forced cleanup.
      Parameters:
      budget - positive remaining drain budget
      Returns:
      true only after actual resource work has exited
      Throws:
      Exception - if safe draining cannot be established
    • close

      void close() throws Exception
      Releases a fully drained or never-published resource; does not close the component.
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception - if durable/endpoint cleanup fails