Interface TransportRuntime
TransportDelegateAttachment. Other callers
must not invoke the runtime independently.
The transport implementation continues to own every external resource and
asynchronous activity started by those calls. It reports failures and final
termination proof through the TransportTerminationSignal borrowed
from its attachment context.
Implementations must make shutdown phase methods prompt, nonblocking, idempotent, thread-safe, and monotonic. A shutdown method initiates work; it does not itself constitute termination proof. Shutdown may be requested before start is invoked; even an unused runtime must report affirmative termination proof after its owned activity has ended.
Soklet defers phase delivery while the configured runtime's start call is still running. If that call returns or throws after the forced boundary, Soklet makes one best-effort forced shutdown invocation on that same lifecycle worker, with the original deadline (remaining time may be zero). This does not extend shutdown or change its frozen result, including its recorded causes. A blocking or failed compensation cannot establish complete termination. Runtime implementations must still honor startup cancelation and initiate shutdown promptly.
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionvoidshutdownForcibly(@NonNull ShutdownContext shutdownContext) Subsumes graceful shutdown and interrupts or cancels only runtime-owned execution.voidshutdownGracefully(@NonNull ShutdownContext shutdownContext) Stops admission and initiates graceful wind-up without waiting for it.voidstart(@NonNull StartupContext startupContext) Binds the transport and returns only after it is ready.
-
Method Details
-
start
Binds the transport and returns only after it is ready. The runtime owner invokes this method at most once.For a synchronous startup failure, throw the original runtime exception or error (retain a checked failure as the cause of a runtime exception). Do not report that same failure or termination proof through the signal before throwing: a signal before the owner's shutdown intent describes independent premature termination. The owner delivers shutdown phases after a failed start, including a partially completed bind. Those methods must remain safe and report affirmative proof once every owned resource and activity ends.
An independent worker failure must still be signaled when observed, even before readiness; an earlier independent failure can control the outcome instead of a later synchronous throw.
- Parameters:
startupContext- startup timing and cancelation information
-
shutdownGracefully
Stops admission and initiates graceful wind-up without waiting for it. Shutdown phases can run even whenstart(StartupContext)was never invoked, for example after another member failed to attach or start. The transport must signal termination once all owned activity has ended, including affirmative proof when no resources or activity were started.- Parameters:
shutdownContext- graceful shutdown timing information
-
shutdownForcibly
Subsumes graceful shutdown and interrupts or cancels only runtime-owned execution. Shutdown phases can run even whenstart(StartupContext)was never invoked, for example after another member failed to attach or start. The transport must signal termination once all owned activity has ended, including affirmative proof when no resources or activity were started.- Parameters:
shutdownContext- forced shutdown timing information
-