Class LifecyclePolicy.Builder

java.lang.Object
com.soklet.LifecyclePolicy.Builder
Enclosing class:
LifecyclePolicy

@NotThreadSafe public static final class LifecyclePolicy.Builder extends Object
Mutable builder for an immutable LifecyclePolicy.
  • Method Details

    • startupTimeout

      Sets the startup timeout. Zero means an immediate boundary. A zero budget leaves no waiting allowance for framework setup or transport startup and can immediately produce StartupDisposition.TIMED_OUT; it does not disable the timeout. Passing null restores the built-in default of 30 seconds.
      Parameters:
      startupTimeout - startup timeout, or null to use the default
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if negative or not representable as signed nanoseconds
    • startupCancelationTimeout

      Sets the startup-cancelation budget. Zero means an immediate boundary. A zero budget leaves no waiting allowance for an active startup call to return after shutdown intent. Remaining startup work stays tracked through the graceful and forced shutdown phases. Passing null restores the built-in default of 2 seconds.
      Parameters:
      startupCancelationTimeout - cancelation budget, or null to use the default
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if negative or not representable as signed nanoseconds
    • gracefulShutdownTimeout

      Sets the graceful shutdown timeout. Zero means an immediate boundary. Passing null restores the built-in default of 15 seconds. A zero budget leaves no waiting allowance for graceful drain; participants without termination proof proceed to forced shutdown.

      This budget is independent of the server request-handler timeout (60 seconds by default). To let all permitted in-flight requests finish, allow their maximum remaining work and response transmission time. A shorter drain intentionally permits interruption and connection closure at the forced boundary. Interruption cannot guarantee that noncooperative application code stops. Long-lived streams need an explicit termination policy; the surrounding process/container budget must also include forced shutdown and operational margin.

      After a closing response, the standard HTTP server closes promptly when the request was fully consumed and no surplus input was observed, including one nonblocking check for input already queued on the socket. If unread input may remain, its one-second lingering-input window consumes this budget even after the response has been written. Short graceful budgets can therefore proceed to forced shutdown while such a client connection still lingers.

      Parameters:
      gracefulShutdownTimeout - graceful shutdown timeout, or null to use the default
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if negative or not representable as signed nanoseconds
    • forcedShutdownTimeout

      Sets the forced shutdown timeout. Zero means an immediate boundary. Passing null restores the built-in default of 3 seconds. A zero budget leaves no waiting allowance for forced termination proof. Any still-unproven or residual work produces an incomplete result. In particular, zero graceful and forced budgets can make even an idle running listener's shutdown incomplete because its stop calls and termination proof are asynchronous.
      Parameters:
      forcedShutdownTimeout - forced shutdown timeout, or null to use the default
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if negative or not representable as signed nanoseconds
    • build

      Returns:
      immutable lifecycle policy
      Throws:
      IllegalArgumentException - if the combined startup-cancelation, graceful-shutdown, and forced-shutdown budget exceeds signed nanoseconds