Package com.jsgalactic.axiom.jdbc
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, defaultdatabasemaxConnections- largest number of concurrent database permits, from 1 to 1024maxWait- longest time a request waits for a permit, from zero to 30 secondsprobeQuery- single short read-only statement used by the health checkprobeTimeout- upper bound of one health probe statement, from one to 30 secondsrouteLimits- optional per-route caps, each from 1 tomaxConnectionscloseConnectionsOnShutdown- 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 Summary
FieldsModifier and TypeFieldDescriptionstatic final JdbcOptionsBounds used when none are supplied.static final intLongest permitted health statement.static final DurationLongest permitted health statement timeout.static final intMost routes with their own cap.static final DurationLongest permitted wait for a permit. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of thecloseConnectionsOnShutdownrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of themaxConnectionsrecord component.maxWait()Returns the value of themaxWaitrecord component.name()Returns the value of thenamerecord component.Returns the value of theprobeQueryrecord component.Returns the value of theprobeTimeoutrecord component.Returns the value of therouteLimitsrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
MAX_WAIT
Longest permitted wait for a permit. -
MAX_PROBE_TIMEOUT
Longest permitted health statement timeout. -
MAX_ROUTE_LIMITS
public static final int MAX_ROUTE_LIMITSMost routes with their own cap. Later configured routes are refused.- See Also:
-
MAX_PROBE_QUERY_LENGTH
public static final int MAX_PROBE_QUERY_LENGTHLongest permitted health statement.- See Also:
-
DEFAULT
Bounds used when none are supplied.
-
-
Constructor Details
-
JdbcOptions
public JdbcOptions(String name, int maxConnections, Duration maxWait, String probeQuery, Duration probeTimeout, Map<Route, Integer> routeLimits, boolean closeConnectionsOnShutdown) Validates the bounds and copies the route limits.- Throws:
IllegalArgumentException- if a bound is out of range or the probe is not one short selectNullPointerException- if a reference field or route key is null
-
-
Method Details
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
maxConnections
public int maxConnections()Returns the value of themaxConnectionsrecord component.- Returns:
- the value of the
maxConnectionsrecord component
-
maxWait
Returns the value of themaxWaitrecord component.- Returns:
- the value of the
maxWaitrecord component
-
probeQuery
Returns the value of theprobeQueryrecord component.- Returns:
- the value of the
probeQueryrecord component
-
probeTimeout
Returns the value of theprobeTimeoutrecord component.- Returns:
- the value of the
probeTimeoutrecord component
-
routeLimits
Returns the value of therouteLimitsrecord component.- Returns:
- the value of the
routeLimitsrecord component
-
closeConnectionsOnShutdown
public boolean closeConnectionsOnShutdown()Returns the value of thecloseConnectionsOnShutdownrecord component.- Returns:
- the value of the
closeConnectionsOnShutdownrecord component
-