/**
  * Traverses the queue hierarchy under the given queue to gather all lists of non-runnable
  * applications.
  */
 private void gatherPossiblyRunnableAppLists(FSQueue queue, List<List<FSAppAttempt>> appLists) {
   if (queue.getNumRunnableApps()
       < scheduler.getAllocationConfiguration().getQueueMaxApps(queue.getName())) {
     if (queue instanceof FSLeafQueue) {
       appLists.add(((FSLeafQueue) queue).getCopyOfNonRunnableAppSchedulables());
     } else {
       for (FSQueue child : queue.getChildQueues()) {
         gatherPossiblyRunnableAppLists(child, appLists);
       }
     }
   }
 }