@SuppressWarnings("squid:S1181")
  private void fireStateChangedListener(T newState, StateChangeListener<T> stateChangeListener) {
    try {
      stateChangeListener.stateChanged(newState);
    } catch (Throwable e) {
      LOGGER.error("Error notifying state change listener for {}", name, e);
    }
  }
Sets the state if the current state {@code .equals()} the specified expected state. If the new
state does not {@code .equals()} the current state, listeners and waiters will be notified.

@return true if the state is set
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/StateMachine.java