Interface JGroupsRaftHealthCheck
Provides liveness, readiness, and cluster-level health information from the local node's perspective. All methods are node-local; they inspect local state only and never issue remote calls, making them safe for frequent polling without impacting cluster performance.
Liveness and Readiness Probes
The two boolean methods map directly to container orchestration health checks:
isNodeLive(): the process is functional. Whenfalse, the node should be restarted. Suitable for Kubernetes liveness probes.isNodeReady(): the node can serve requests. Whenfalse, traffic should be routed away. Suitable for Kubernetes readiness probes.
Cluster Health
getClusterHealth() returns a coarse-grained view of the cluster. The status reflects the local node's knowledge
of the cluster membership and leader state; different nodes may briefly disagree during view changes or elections.
For a complete picture, collect health from all nodes.
Availability Before Start
This interface is available from the moment JGroupsRaft is constructed, even before JGroupsRaft.start()
is called. Before start, isNodeLive() and isNodeReady() return false, and
getClusterHealth() returns JGroupsRaftHealthCheck.ClusterHealth.NOT_RUNNING.
- Since:
- 2.0
- Author:
- José Bolina
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumCoarse-grained cluster health status from a single node's perspective. -
Method Summary
Modifier and TypeMethodDescriptionOverall cluster health from this node's perspective.booleanWhether the node process is functional.booleanWhether the node can serve requests.
-
Method Details
-
isNodeLive
boolean isNodeLive()Whether the node process is functional.Returns
truewhen the JGroups channel is connected and not closed. Use this for liveness probes (e.g., Kubernetes). Afalsevalue means the process is not started or should be restarted.- Returns:
trueif the node is live.
-
isNodeReady
boolean isNodeReady()Whether the node can serve requests.Returns
truewhen the channel is connected, a leader is known, and the instance is started. Use this for readiness probes (e.g., Kubernetes). Afalsevalue means traffic should be routed away from this node.- Returns:
trueif the node is ready to handle requests.
-
getClusterHealth
JGroupsRaftHealthCheck.ClusterHealth getClusterHealth()Overall cluster health from this node's perspective.NOT_RUNNING: channel is disconnected.HEALTHY: leader exists and all configured members are active.DEGRADED: leader exists and active nodes >= majority but not all.FAILURE: no leader or active nodes below majority.
- Returns:
- the cluster health status.
-