Class TomcatSettings.Builder

java.lang.Object
org.apache.juneau.microservice.tomcat.TomcatSettings.Builder
Enclosing class:
TomcatSettings

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

    • build

      Builds a new TomcatSettings from this builder.
      Returns:
      A new settings instance.
    • ports

      public TomcatSettings.Builder ports(int... value)
      Specifies the ports to try when binding the Tomcat server.

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

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

      Specifies the Catalina base directory used by the embedded Tomcat server for its work files.

      When set, the TomcatServerFactory uses this directory as both the Catalina base and the root context doc-base, and the directory is left in place after the server stops. When not set, the TomcatServerComponent creates a fresh temp directory on start-up and deletes it on stop.

      Parameters:
      value - The absolute or relative path to the base directory. Can be null to use an auto-created temp directory.
      Returns:
      This object.
    • stopTimeout

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

      On stop, the connector is paused (stops accepting new requests) and the component waits up to this duration for in-flight requests to complete before the server stops. When set, this value takes precedence over the Tomcat/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 is paused 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 Tomcat/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.