Description
FifoPolicy gives all of a queue's share to the earliest-scheduled application.
Schedulable earliest = null; for (Schedulable schedulable : schedulables) { if (earliest == null || schedulable.getStartTime() < earliest.getStartTime()) { earliest = schedulable; } } earliest.setFairShare(Resources.clone(totalResources));
If the queue has no schedulables in it, earliest will be left null, leading to an NPE on the last line.