Interface HealthCheckResult
-
- All Superinterfaces:
java.lang.Comparable<HealthCheckResult>
,java.util.Comparator<HealthCheckResult>
,java.io.Serializable
@NotExtensible @ThreadSafety(level=INTERFACE_NOT_THREADSAFE) public interface HealthCheckResult extends java.lang.Comparable<HealthCheckResult>, java.util.Comparator<HealthCheckResult>, java.io.Serializable
This interface defines a set of methods that may be used to assess the health of an LDAP external server. A health check result consists of both a state (AVAILABLE, DEGRADED, or UNAVAILABLE) and a numeric score that may be used to help differentiate servers with the same health check state.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
betterThan(HealthCheckResult r)
Indicates whether this health check result is considered better than the provided result.int
compare(HealthCheckResult r1, HealthCheckResult r2)
Compares the provided health check results to determine their relative order in a sorted list.int
compareTo(HealthCheckResult r)
Compares the provided health check result with this health check result to determine their relative order in a sorted list.boolean
equals(java.lang.Object o)
Indicates whether the provided object may be considered equal to this health check result.java.util.List<java.lang.String>
getMessages()
Retrieves a list of messages providing additional information about the reason for the associated state and score.int
getScore()
Retrieves the numeric score for the associated server, which may be used to help differentiate the server from other servers with the same state.HealthCheckState
getState()
Retrieves the health check state for the associated server.long
getTime()
Retrieves the time that this health check result was created.int
hashCode()
Retrieves a hash code for this health check result.java.lang.String
toString()
Retrieves a string representation of this health check result.boolean
worseThan(HealthCheckResult r)
Indicates whether this health check result is considered worse than the provided result.
-
-
-
Method Detail
-
getState
HealthCheckState getState()
Retrieves the health check state for the associated server.- Returns:
- The health check state for the associated server.
-
getScore
int getScore()
Retrieves the numeric score for the associated server, which may be used to help differentiate the server from other servers with the same state. The value returned will be an integer between 10 (the most healthy) and 1 (the least healthy) for a state of AVAILABLE or DEGRADED, or zero for a state of UNAVAILABLE.- Returns:
- The numeric score for the associated server.
-
getMessages
java.util.List<java.lang.String> getMessages()
Retrieves a list of messages providing additional information about the reason for the associated state and score.- Returns:
- A list of messages providing additional information about the reason for the associated state and score, or an empty list if no messages are available.
-
getTime
long getTime()
Retrieves the time that this health check result was created. The value returned will be an offset in milliseconds since 12:00 a.m. on January 1, 1970.- Returns:
- The time that this health check result was created.
-
hashCode
int hashCode()
Retrieves a hash code for this health check result.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- A hash code for this health check result.
-
equals
boolean equals(java.lang.Object o)
Indicates whether the provided object may be considered equal to this health check result.- Specified by:
equals
in interfacejava.util.Comparator<HealthCheckResult>
- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- The object for which to make the determination.- Returns:
true
if the provided object may be considered equal to this health check result, orfalse
if not.
-
compareTo
int compareTo(HealthCheckResult r)
Compares the provided health check result with this health check result to determine their relative order in a sorted list. The ordering will be based primarily on the health check state, and the score will be used to differentiate between servers with the same state.- Specified by:
compareTo
in interfacejava.lang.Comparable<HealthCheckResult>
- Parameters:
r
- The health check result to be compared with this health check result. It must not benull
.- Returns:
- A negative value if this health check result should be ordered before the provided result, a positive value if this health check result should be ordered after the provided result, or zero if they are logically equivalent.
-
compare
int compare(HealthCheckResult r1, HealthCheckResult r2)
Compares the provided health check results to determine their relative order in a sorted list. The ordering will be based primarily on the health check state, and the score will be used to differentiate between servers with the same state.- Specified by:
compare
in interfacejava.util.Comparator<HealthCheckResult>
- Parameters:
r1
- The first health check result to be compared. It must not benull
.r2
- The second health check result to be compared. It must not benull
.- Returns:
- A negative value if the first health check result should be ordered before the second, a positive value if the first health check result should be ordered after the second, or zero if they are logically equivalent.
-
betterThan
boolean betterThan(HealthCheckResult r)
Indicates whether this health check result is considered better than the provided result.- Parameters:
r
- The result for which to make the determination. It must not benull
.- Returns:
true
if this health check result is considered better than the provided result, orfalse
if this health check result is worse than or equivalent to the provided result.
-
worseThan
boolean worseThan(HealthCheckResult r)
Indicates whether this health check result is considered worse than the provided result.- Parameters:
r
- The result for which to make the determination. It must not benull
.- Returns:
true
if this health check result is considered worse than the provided result, orfalse
if this health check result is better than or equivalent to the provided result.
-
toString
java.lang.String toString()
Retrieves a string representation of this health check result.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of this health check result.
-
-