@Override
    public int compare(ServerQueueStatus s1, ServerQueueStatus s2) {
      // sort primaries to the front of the list
      if (s1.isPrimary() && !s2.isPrimary()) {
        return -1;
      } else if (!s1.isPrimary() && s2.isPrimary()) {
        return 1;
      } else {
        int diff = s1.getServerQueueSize() - s2.getServerQueueSize();
        if (diff != 0) {
          return diff;
        } else {
          return s1.getMemberId().compareTo(s2.getMemberId());
        }
      }
    }
A comparator which sorts queue elements in the order of primary first redundant with smallest
queue size ... redundant with largest queue size
geode-core/src/main/java/org/apache/geode/cache/client/internal/QueueManagerImpl.java