Enum Class DrainStrategy

java.lang.Object
java.lang.Enum<DrainStrategy>
org.microproxy.DrainStrategy
All Implemented Interfaces:
Serializable, Comparable<DrainStrategy>, Constable

public enum DrainStrategy extends Enum<DrainStrategy>
How a draining proxy (HttpProxyServer.drain(java.time.Duration)) tells its clients to go elsewhere, as Envoy's --drain-strategy: each new request may be answered with Connection: close (HTTP/1) or make the proxy send GOAWAY (HTTP/2, HTTP/3) on its connection.
  • Enum Constant Details

    • GRADUAL

      public static final DrainStrategy GRADUAL
      The chance that a request drains its connection grows from 0 at the start of the drain to 1 at its end, so clients move away gradually rather than all at once (the default).
    • IMMEDIATE

      public static final DrainStrategy IMMEDIATE
      Every connection is told at once: idle ones are closed, busy ones close after their request in progress.
  • Method Details

    • values

      public static DrainStrategy[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static DrainStrategy valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • parse

      public static DrainStrategy parse(String name)
      The strategy named name, in any case.
      Parameters:
      name - gradual or immediate
      Returns:
      the strategy
      Throws:
      IllegalArgumentException - for another name