Interface JGroupsRaftHealthCheck


@ThreadSafe public interface JGroupsRaftHealthCheck
Health monitoring for a Raft node.

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. When false, the node should be restarted. Suitable for Kubernetes liveness probes.
  • isNodeReady(): the node can serve requests. When false, 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:
  • Method Details

    • isNodeLive

      boolean isNodeLive()
      Whether the node process is functional.

      Returns true when the JGroups channel is connected and not closed. Use this for liveness probes (e.g., Kubernetes). A false value means the process is not started or should be restarted.

      Returns:
      true if the node is live.
    • isNodeReady

      boolean isNodeReady()
      Whether the node can serve requests.

      Returns true when the channel is connected, a leader is known, and the instance is started. Use this for readiness probes (e.g., Kubernetes). A false value means traffic should be routed away from this node.

      Returns:
      true if the node is ready to handle requests.
    • 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.