Class RaftHealthCheck
java.lang.Object
com.loomcache.server.consensus.RaftHealthCheck
Health check and diagnostic utility for Raft consensus nodes.
Purpose: Provides methods to assess the health status of a Raft node, including role validation, log consistency, and heartbeat tracking.
Thread Safety: This class is thread-safe. Multiple threads can safely invoke diagnostic methods concurrently.
- Since:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordImmutable status record of Raft node at a point in time. -
Constructor Summary
ConstructorsConstructorDescriptionRaftHealthCheck(RaftNode raftNode) Creates a new RaftHealthCheck for monitoring the given Raft node. -
Method Summary
Modifier and TypeMethodDescriptionGet diagnostics information for debugging.Get detailed status of the Raft node.booleanDetermines if the Raft node is in a healthy state.
-
Constructor Details
-
RaftHealthCheck
Creates a new RaftHealthCheck for monitoring the given Raft node.- Parameters:
raftNode- the Raft node to monitor (must not be null)- Throws:
NullPointerException- if raftNode is null
-
-
Method Details
-
isHealthy
public boolean isHealthy()Determines if the Raft node is in a healthy state.A node is considered healthy if: - It is in a valid state (FOLLOWER, CANDIDATE, or LEADER) - Its log is accessible and consistent - For followers: it receives heartbeats periodically
- Returns:
- true if the node is healthy, false otherwise
-
getStatus
Get detailed status of the Raft node.- Returns:
- Status record with current node state (never null)
-
getDiagnostics
-