private void sort(final List<SubscriptionEvent> events) {
    events.sort(
        Comparator.comparingLong(event -> getStates(event.getCommitContext().getTopicName())));
  }
Sorts a list of SubscriptionEvents according to the event count in the subscription states.
Events with fewer counts are prioritized.

@param events the list of events to sort
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/subscription/broker/SubscriptionStates.java