code: public void stop() {
      try {
        mRMClient.unregisterApplicationMaster(FinalApplicationStatus.SUCCEEDED, "", "");
      } catch (YarnException e) {
        LOG.error("Failed to unregister application", e);
      } catch (IOException e) {
        LOG.error("Failed to unregister application", e);
      }
      mRMClient.stop();
      // TODO(andrew): Think about whether we should stop mNMClient here
      mYarnClient.stop();
    }
docs: Shuts down the application master, unregistering it from Yarn and stopping its clients.