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 ) ; }
Handles a heartbeat request .