Package com.tnsai.spi
Record Class Healthcheckable.HealthStatus
java.lang.Object
java.lang.Record
com.tnsai.spi.Healthcheckable.HealthStatus
- Record Components:
reachable-truewhen the service responded successfully within the deadlineerrorMessage- human-readable reason the probe failed; empty on successlatency- observed wall-clock latency of the probe
- Enclosing interface:
Healthcheckable
public static record Healthcheckable.HealthStatus(boolean reachable, Optional<String> errorMessage, Duration latency)
extends Record
Outcome of a reachability probe.
-
Constructor Summary
ConstructorsConstructorDescriptionHealthStatus(boolean reachable, Optional<String> errorMessage, Duration latency) Creates an instance of aHealthStatusrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Returns the value of theerrorMessagerecord component.final inthashCode()Returns a hash code value for this object.static Healthcheckable.HealthStatusThe service answered the probe within the timeout.latency()Returns the value of thelatencyrecord component.booleanReturns the value of thereachablerecord component.final StringtoString()Returns a string representation of this record class.static Healthcheckable.HealthStatusunreachable(String message, Duration latency) The probe failed (network down, auth rejected, deadline missed, etc.).
-
Constructor Details
-
HealthStatus
Creates an instance of aHealthStatusrecord class.- Parameters:
reachable- the value for thereachablerecord componenterrorMessage- the value for theerrorMessagerecord componentlatency- the value for thelatencyrecord component
-
-
Method Details
-
healthy
The service answered the probe within the timeout. -
unreachable
The probe failed (network down, auth rejected, deadline missed, etc.). Themessageshould be safe to log — no credentials, no full stack traces. -
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 '=='. -
reachable
public boolean reachable()Returns the value of thereachablerecord component.- Returns:
- the value of the
reachablerecord component
-
errorMessage
Returns the value of theerrorMessagerecord component.- Returns:
- the value of the
errorMessagerecord component
-
latency
Returns the value of thelatencyrecord component.- Returns:
- the value of the
latencyrecord component
-