private CompletableFuture<Long> apply(InitializeEntry entry) {
    // Iterate through all the server sessions and reset timestamps. This ensures that sessions do not
    // timeout during leadership changes or shortly thereafter.
    long timestamp = executor.timestamp(entry.getTimestamp());
    for (ServerSessionContext session : executor.context().sessions().sessions.values()) {
      session.setTimestamp(timestamp);
    }
    log.release(entry.getIndex());
    return Futures.completedFutureAsync(entry.getIndex(), ThreadContext.currentContextOrThrow().executor());
  }
private CompletableFuture < Long > apply ( InitializeEntry entry ) { long timestamp = executor . timestamp ( entry . getTimestamp ( ) ) ; for ( ServerSessionContext session : executor . context ( ) . sessions ( ) . sessions . values ( ) ) { session . setTimestamp ( timestamp ) ; } log . release ( entry . getIndex ( ) ) ; return Futures . completedFutureAsync ( entry . getIndex ( ) , ThreadContext . currentContextOrThrow ( ) . executor ( ) ) ; }
Applies an initialize entry to the state machine.
<p>
Initialize entries are committed by leaders at the start of their term. Typically, no-op entries
serve as a mechanism to allow leaders to commit entries from prior terms. However, we extend
the functionality of the no-op entry to use it as an indicator that a leadership change occurred.
In order to ensure timeouts do not expire during lengthy leadership changes, we use no-op entries
to reset timeouts for client sessions and server heartbeats.