Search in sources :

Example 1 with HeartbeatResponse

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);
}
Also used : HeartbeatResponse(io.atomix.protocols.raft.protocol.HeartbeatResponse)

Example 2 with HeartbeatResponse

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);
}
Also used : HeartbeatResponse(io.atomix.protocols.raft.protocol.HeartbeatResponse)

Aggregations

HeartbeatResponse (io.atomix.protocols.raft.protocol.HeartbeatResponse)2