public void registerIndexQuery(long index, Runnable query) {
    // Add a query to be run once the session's index reaches the given index.
    List<Runnable> queries = this.indexQueries.computeIfAbsent(index, v -> new LinkedList<>());
    queries.add(query);
  }
public void registerIndexQuery ( long index , Runnable query ) { List < Runnable > queries = this . indexQueries . computeIfAbsent ( index , v -> new LinkedList < > ( ) ) ; queries . add ( query ) ; }
Registers a session index query.

@param index The state machine index at which to execute the query.
@param query The query to execute.