YarnIntraNonHaMasterServices extends AbstractYarnNonHaServices { @Override public void close() throws Exception { if (enterUnlessClosed()) { try { try { resourceManagerLeaderElectionService.shutdown(); dispatcher.shutdownNow(); } finally { super.close(); } } finally { exit(); } } } YarnIntraNonHaMasterServices(
			Configuration config,
			org.apache.hadoop.conf.Configuration hadoopConf); @Override LeaderRetrievalService getResourceManagerLeaderRetriever(); @Override LeaderRetrievalService getDispatcherLeaderRetriever(); @Override LeaderElectionService getResourceManagerLeaderElectionService(); @Override LeaderElectionService getDispatcherLeaderElectionService(); @Override LeaderElectionService getJobManagerLeaderElectionService(JobID jobID); @Override LeaderRetrievalService getJobManagerLeaderRetriever(JobID jobID); @Override LeaderRetrievalService getJobManagerLeaderRetriever(JobID jobID, String defaultJobManagerAddress); @Override void close();  }
@Test public void testRepeatedClose() throws Exception { final Configuration flinkConfig = new Configuration(); final YarnHighAvailabilityServices services = new YarnIntraNonHaMasterServices(flinkConfig, hadoopConfig); services.closeAndCleanupAllData(); services.close(); }