private FSAppAttempt addApp(FSLeafQueue queue, String user) {
   ApplicationId appId = ApplicationId.newInstance(0l, appNum++);
   ApplicationAttemptId attId = ApplicationAttemptId.newInstance(appId, 0);
   boolean runnable = maxAppsEnforcer.canAppBeRunnable(queue, user);
   FSAppAttempt app = new FSAppAttempt(scheduler, attId, user, queue, null, rmContext);
   queue.addApp(app, runnable);
   if (runnable) {
     maxAppsEnforcer.trackRunnableApp(app);
   } else {
     maxAppsEnforcer.trackNonRunnableApp(app);
   }
   return app;
 }
 private void removeApp(FSAppAttempt app) {
   app.getQueue().removeApp(app);
   maxAppsEnforcer.untrackRunnableApp(app);
   maxAppsEnforcer.updateRunnabilityOnAppRemoval(app, app.getQueue());
 }