Record Class JdbcOptions

java.lang.Object
java.lang.Record
com.jsgalactic.axiom.jdbc.JdbcOptions
Record Components:
name - bounded metric tag value for the wrapped DataSource, default database
maxConnections - largest number of concurrent database permits, from 1 to 1024
maxWait - longest time a request waits for a permit, from zero to 30 seconds
probeQuery - single short read-only statement used by the health check
probeTimeout - upper bound of one health probe statement, from one to 30 seconds
routeLimits - optional per-route caps, each from 1 to maxConnections
closeConnectionsOnShutdown - whether application close closes still-open wrapped connections

public record JdbcOptions(String name, int maxConnections, Duration maxWait, String probeQuery, Duration probeTimeout, Map<Route,Integer> routeLimits, boolean closeConnectionsOnShutdown) extends Record
Immutable bounds of a Jdbc gate.

Every field is validated when an instance is created: the metric name is a bounded tag value, the connection caps and the bounded wait are positive and limited, the health probe is a single short SELECT statement, and the per-route caps never exceed the aggregate cap. The route limits are a fixed set of application-chosen routes, so the gate's metric series stay bounded.

  • Field Details

    • MAX_WAIT

      public static final Duration MAX_WAIT
      Longest permitted wait for a permit.
    • MAX_PROBE_TIMEOUT

      public static final Duration MAX_PROBE_TIMEOUT
      Longest permitted health statement timeout.
    • MAX_ROUTE_LIMITS

      public static final int MAX_ROUTE_LIMITS
      Most routes with their own cap. Later configured routes are refused.
      See Also:
    • MAX_PROBE_QUERY_LENGTH

      public static final int MAX_PROBE_QUERY_LENGTH
      Longest permitted health statement.
      See Also:
    • DEFAULT

      public static final JdbcOptions DEFAULT
      Bounds used when none are supplied.
  • Constructor Details

  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • maxConnections

      public int maxConnections()
      Returns the value of the maxConnections record component.
      Returns:
      the value of the maxConnections record component
    • maxWait

      public Duration maxWait()
      Returns the value of the maxWait record component.
      Returns:
      the value of the maxWait record component
    • probeQuery

      public String probeQuery()
      Returns the value of the probeQuery record component.
      Returns:
      the value of the probeQuery record component
    • probeTimeout

      public Duration probeTimeout()
      Returns the value of the probeTimeout record component.
      Returns:
      the value of the probeTimeout record component
    • routeLimits

      public Map<Route,Integer> routeLimits()
      Returns the value of the routeLimits record component.
      Returns:
      the value of the routeLimits record component
    • closeConnectionsOnShutdown

      public boolean closeConnectionsOnShutdown()
      Returns the value of the closeConnectionsOnShutdown record component.
      Returns:
      the value of the closeConnectionsOnShutdown record component