private void transitionToDoneState(QueryState doneState) {
    requireNonNull(doneState, "doneState is null");
    checkArgument(doneState.isDone(), "doneState %s is not a done state", doneState);

    queryState.setIf(doneState, currentState -> !currentState.isDone());
  }
State machine for a {@link QueryExecution}. It stores the states for the {@link QueryExecution}.
Others can register listeners when the state changes of the {@link QueryExecution}.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/QueryStateMachine.java