FifoOrderingPolicyForPendingApps extends AbstractComparatorOrderingPolicy<S> { public FifoOrderingPolicyForPendingApps() { List<Comparator<SchedulableEntity>> comparators = new ArrayList<Comparator<SchedulableEntity>>(); comparators.add(new RecoveryComparator()); comparators.add(new PriorityComparator()); comparators.add(new FifoComparator()); this.comparator = new CompoundComparator(comparators); this.schedulableEntities = new ConcurrentSkipListSet<S>(comparator); } FifoOrderingPolicyForPendingApps(); @Override String getInfo(); @Override String getConfigName(); @Override void configure(Map<String, String> conf); @Override void containerAllocated(S schedulableEntity, RMContainer r); @Override void containerReleased(S schedulableEntity, RMContainer r); @Override void demandUpdated(S schedulableEntity);  }
@Test public void testFifoOrderingPolicyForPendingApps() { FifoOrderingPolicyForPendingApps<MockSchedulableEntity> policy = new FifoOrderingPolicyForPendingApps<MockSchedulableEntity>(); MockSchedulableEntity r1 = new MockSchedulableEntity(); MockSchedulableEntity r2 = new MockSchedulableEntity(); assertThat(policy.getComparator().compare(r1, r2)).isEqualTo(0); r1.setSerial(1); r1.setRecovering(true); assertThat(policy.getComparator().compare(r1, r2)).isEqualTo(-1); r1.setRecovering(false); r2.setSerial(2); r2.setRecovering(true); assertThat(policy.getComparator().compare(r1, r2)).isEqualTo(1); }