code: private void indexQuery(QueryEntry entry, ServerSessionContext session, CompletableFuture<QueryResponse> future) {
      // If the query index is greater than the session's last applied index, queue the request for handling once the
      // state machine is caught up.
      if (entry.getIndex() > session.getLastApplied()) {
        session.registerIndexQuery(entry.getIndex(), () -> applyQuery(entry, future));
      } else {
        applyQuery(entry, future);
      }
    }
docs: Ensures the given query is applied after the appropriate index.