Class JettySettings.Builder

java.lang.Object
org.apache.juneau.microservice.jetty.JettySettings.Builder
Enclosing class:
JettySettings

public static class JettySettings.Builder extends Object
Builder for JettySettings.
  • Method Details

    • build

      public JettySettings build()
      Builds a new JettySettings from this builder.
      Returns:
      A new settings instance.
    • ports

      public JettySettings.Builder ports(int... value)
      Specifies the ports to try when binding the Jetty server.

      The first available port is used. A value of 0 indicates "try a random port". When set, this value takes precedence over the Jetty/port config-file entry and the Jetty-Port manifest entry.

      Parameters:
      value - The candidate ports, in priority order. Can be null to defer to config / manifest.
      Returns:
      This object.
    • jettyXml

      public JettySettings.Builder jettyXml(Object value, boolean resolveVars) throws IOException
      Specifies the contents or location of the jetty.xml file used to build the Jetty server.

      When set, this value takes precedence over the Jetty/config config-file entry and the Jetty-Config manifest entry. When not set, the component falls back to those values and finally to a jetty.xml file located on the file system or classpath.

      Parameters:
      value - The contents or location of the file. Can be any of:
      • String - Relative path to a file on the file system or classpath, or the raw XML content if it begins with <.
      • File - File on the file system.
      • Path - Path on the file system.
      • InputStream - Raw contents as a UTF-8 encoded stream.
      • Reader - Raw contents.

      Can be null (defers to config / manifest / classpath resolution).
      resolveVars - If true, SVL variables in the file will automatically be resolved.
      Returns:
      This object.
      Throws:
      IOException - Thrown by underlying stream.
    • stopTimeout

      Specifies the bounded graceful-shutdown drain timeout for the Jetty server.

      On stop, the server stops accepting new connections and waits up to this duration for in-flight requests to complete before the connector closes (Jetty's stopTimeout). When set, this value takes precedence over the Jetty/stopTimeout config-file entry (in milliseconds). When neither is set, a default of 30s is applied.

      Parameters:
      value - The drain timeout. Can be null to defer to config, then to the default.
      Returns:
      This object.
    • shutdownSettleDelay

      Specifies the settle delay applied between flipping the readiness probe out of service and stopping the connector.

      On stop, the readiness probe (/readyz) flips to 503 before the connector closes so a load balancer / Kubernetes stops routing new traffic. This brief delay gives the load balancer time to observe the 503 before in-flight requests are drained. When set, this value takes precedence over the Jetty/shutdownSettleDelay config-file entry (in milliseconds). When neither is set, no settle delay is applied (defaults to 0) — the recommended Kubernetes pattern is a preStop hook sleep instead.

      Parameters:
      value - The settle delay. Can be null to defer to config, then to the default.
      Returns:
      This object.