use of io.atomix.protocols.raft.protocol.HeartbeatResponse in project atomix by atomix.
the class RaftProxyManager method handleHeartbeat.
/**
* Handles a heartbeat request.
*/
private CompletableFuture<HeartbeatResponse> handleHeartbeat(HeartbeatRequest request) {
log.trace("Received {}", request);
boolean newLeader = !Objects.equals(selectorManager.leader(), request.leader());
selectorManager.resetAll(request.leader(), request.members());
HeartbeatResponse response = HeartbeatResponse.builder().withStatus(RaftResponse.Status.OK).build();
if (newLeader) {
resetAllIndexes();
}
log.trace("Sending {}", response);
return CompletableFuture.completedFuture(response);
}
use of io.atomix.protocols.raft.protocol.HeartbeatResponse in project atomix by atomix.
the class RaftSessionManager method handleHeartbeat.
/**
* Handles a heartbeat request.
*/
private CompletableFuture<HeartbeatResponse> handleHeartbeat(HeartbeatRequest request) {
log.trace("Received {}", request);
boolean newLeader = !Objects.equals(selectorManager.leader(), request.leader());
selectorManager.resetAll(request.leader(), request.members());
HeartbeatResponse response = HeartbeatResponse.builder().withStatus(RaftResponse.Status.OK).build();
if (newLeader) {
resetAllIndexes();
}
log.trace("Sending {}", response);
return CompletableFuture.completedFuture(response);
}
Aggregations