Class ShutdownCleanup
java.lang.Object
com.soklet.ShutdownCleanup
Immutable specification for one bounded, synchronous cleanup action for an
ingress-exclusive application resource. Returning after merely delegating
asynchronous work is not proof that the resource was released.
At the cleanup deadline, Soklet requests interruption of a running action and stops waiting for it. Interruption is cooperative and may cause interruption-sensitive I/O to fail; it does not forcibly terminate arbitrary cleanup code. Actions should respond promptly to interruption and apply their own bounds to blocking work.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceOne synchronous cleanup action for an ingress-exclusive application resource. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull ShutdownCleanupfromTimeoutAndAction(@NonNull Duration timeout, @NonNull ShutdownCleanup.Action action) Creates a cleanup specification from its deadline budget and synchronous action.
-
Method Details
-
fromTimeoutAndAction
public static @NonNull ShutdownCleanup fromTimeoutAndAction(@NonNull Duration timeout, @NonNull ShutdownCleanup.Action action) Creates a cleanup specification from its deadline budget and synchronous action.- Parameters:
timeout- positive cleanup deadline budget representable as signed nanosecondsaction- synchronous cleanup action- Returns:
- immutable cleanup specification
- Throws:
IllegalArgumentException- iftimeoutis non-positive or exceeds signed-nanosecond range
-
getTimeout
- Returns:
- positive cleanup deadline budget
-