@Override
    public int compare(Item<T> o1, Item<T> o2) {

      Priority p1 = o1.producerContext.getPriority();
      Priority p2 = o2.producerContext.getPriority();

      if (p1 == p2) {
        // lower time wins in this case, so minimum value
        return Double.compare(o1.time, o2.time);
      } else {
        // priority ordering is via ordinals
        if (p1.ordinal() > p2.ordinal()) {
          // higher priority gets minimum value (pq is min-heap based)
          return -1;
        } else {
          return 1;
        }
      }
    }
Time based, priority starving throttling producer.

<p>This means for any # of elements, all of the higher priority items will be run before any of
the lower priority items. Within the groups, send order is the same as order they were given to
the class. (based on nano time).
imagepipeline/src/main/java/com/facebook/imagepipeline/producers/PriorityStarvingThrottlingProducer.java