code: private void resubmit(long commandSequence, OperationAttempt<?, ?> attempt) {
      // If the client's response sequence number is greater than the given command sequence number,
      // the cluster likely has a new leader, and we need to reset the sequencing in the leader by
      // sending a keep-alive request.
      // Ensure that the client doesn't resubmit many concurrent KeepAliveRequests by tracking the last
      // keep-alive response sequence number and only resubmitting if the sequence number has changed.
      long responseSequence = state.getCommandResponse();
      if (commandSequence < responseSequence && keepAliveIndex.get() != responseSequence) {
        keepAliveIndex.set(responseSequence);
        manager.resetIndexes(state.getSessionId()).whenCompleteAsync((result, error) -> {
          if (error == null) {
            resubmit(responseSequence, attempt);
          } else {
            keepAliveIndex.set(0);
            attempt.retry(Duration.ofSeconds(FIBONACCI[Math.min(attempt.attempt - 1, FIBONACCI.length - 1)]));
          }
        }, context);
      } else {
        for (Map.Entry<Long, OperationAttempt> entry : attempts.entrySet()) {
          OperationAttempt operation = entry.getValue();
          if (operation instanceof CommandAttempt && operation.request.sequenceNumber() > commandSequence && operation.attempt <= attempt.attempt) {
            operation.retry();
          }
        }
      }
    }
docs: Resubmits commands starting after the given sequence number.
  <p>
  The sequence number from which to resend commands is the <em>request</em> sequence number, not the client-side
  sequence number. We resend only commands since queries cannot be reliably resent without losing linearizable
  semantics. Commands are resent by iterating through all pending operation attempts and retrying commands where the
  sequence number is greater than the given {@code commandSequence} number and the attempt number is less than or
  equal to the version.