public static void main(String args[]) {

		Properties properties = StringUtils.splitArrayElementsIntoProperties(args, "=");
		if (properties == null) {
			properties = new Properties();
		}

		boolean nokill = Boolean.parseBoolean(properties.getProperty("nokill"));
		String appid = properties.getProperty("appid");

		if (nokill) {
			new Main().doMain(new String[] {
					YarnSystemConstants.DEFAULT_CONTEXT_FILE_CLIENT,
					YarnSystemConstants.DEFAULT_ID_CLIENT,
					CommandLineClientRunner.OPT_SUBMIT
			});
		} else if (appid != null) {
			new Main().doMain(new String[] {
					YarnSystemConstants.DEFAULT_CONTEXT_FILE_CLIENT,
					YarnSystemConstants.DEFAULT_ID_CLIENT,
					CommandLineClientRunner.OPT_KILL,
					CommandLineClientRunner.ARG_APPLICATION_ID + "=" + appid
			});
		} else if (!nokill) {
			ConfigurableApplicationContext context = null;
			try {
				context = new ClassPathXmlApplicationContext("application-context.xml");
				System.out.println("Submitting kill-application example");
				YarnClient client = (YarnClient) context.getBean("yarnClient");
				ApplicationId applicationId = client.submitApplication();
				System.out.println("Submitted kill-application example");
				System.out.println("Waiting 30 seconds before aborting the application");
				Thread.sleep(30000);
				System.out.println("Asking resource manager to abort application with applicationid=" + applicationId);
				client.killApplication(applicationId);
			} catch (Throwable e) {
				log.error("Error in main method", e);
			} finally {
				if (context != null) {
					context.close();
				}
			}
		}
	}
Main class for kill-application example.

@author Janne Valkealahti
yarn/yarn/kill-application/src/main/java/org/springframework/yarn/examples/Main.java