Example usage for org.apache.hadoop.util ExitUtil terminate

List of usage examples for org.apache.hadoop.util ExitUtil terminate

Introduction

In this page you can find the example usage for org.apache.hadoop.util ExitUtil terminate.

Prototype

public static void terminate(int status, String msg) throws ExitException 

Source Link

Document

Terminate the current process.

Usage

From source file:ApplicationMaster.java

License:Apache License

/**
 * @param args Command line args/*w ww  . java 2 s.co  m*/
 */
public static void main(String[] args) {
    boolean result = false;
    try {
        ApplicationMaster appMaster = new ApplicationMaster();
        LOG.info("Initializing ApplicationMaster");
        boolean doRun = appMaster.init(args);
        if (!doRun) {
            System.exit(0);
        }
        appMaster.run();
        result = appMaster.finish();
    } catch (Throwable t) {
        LOG.fatal("Error running ApplicationMaster", t);
        LogManager.shutdown();
        ExitUtil.terminate(1, t);
    }
    if (result) {
        LOG.info("Application Master completed successfully. exiting");
        System.exit(0);
    } else {
        LOG.info("Application Master failed. exiting");
        System.exit(2);
    }
}

From source file:cn.edu.buaa.act.petuumOnYarn.ApplicationMaster.java

License:Apache License

/**
 * @param args//from ww  w. j a  va2 s  .c  om
 *            Command line args
 */
public static void main(String[] args) {
    startTime = System.currentTimeMillis();
    boolean result = false;
    try {
        ApplicationMaster appMaster = new ApplicationMaster();
        LOG.info("Initializing ApplicationMaster");
        boolean doRun = appMaster.init(args);
        if (!doRun) {
            System.exit(0);
        }
        appMaster.run();
        result = appMaster.finish();
    } catch (Throwable t) {
        LOG.fatal("Error running ApplicationMaster", t);
        LogManager.shutdown();
        ExitUtil.terminate(1, t);
    }
    if (result) {
        LOG.info("Application Master completed successfully. exiting");
        System.exit(0);
    } else {
        LOG.info("Application Master failed. exiting");
        System.exit(2);
    }
}

From source file:com.scistor.dshell.ScistorApplicationMaster.java

License:Apache License

/**
 * @param args/*from   w ww  . ja v  a 2s .c  om*/
 *            Command line args
 */
public static void main(String[] args) {
    boolean result = false;
    try {
        ScistorApplicationMaster appMaster = new ScistorApplicationMaster();
        LOG.info("=====Initializing ApplicationMaster");
        boolean doRun = appMaster.init(args);
        if (!doRun) {
            System.exit(0);
        }
        appMaster.run();
        result = appMaster.finish();
    } catch (Throwable t) {
        LOG.fatal("Error running ApplicationMaster", t);
        LogManager.shutdown();
        ExitUtil.terminate(1, t);
    }
    if (result) {
        LOG.info("Application Master completed successfully. exiting");
        System.exit(0);
    } else {
        LOG.info("Application Master failed. exiting");
        System.exit(2);
    }
}

From source file:com.sogou.dockeronyarn.service.DockerApplicationMaster_24.java

License:Apache License

/**
 * @param args Command line args/*  w w w . j a  v a 2s. co  m*/
 */
public static void main(String[] args) {
    boolean result = false;
    try {
        DockerApplicationMaster_24 appMaster = new DockerApplicationMaster_24();
        LOG.info("Initializing ApplicationMaster");
        boolean doRun = appMaster.init(args);
        if (!doRun) {
            System.exit(0);
        }
        appMaster.run();
        result = appMaster.finish();
    } catch (Throwable t) {
        LOG.fatal("Error running ApplicationMaster", t);
        LogManager.shutdown();
        ExitUtil.terminate(1, t);
    }
    if (result) {
        LOG.info("Application Master completed successfully. exiting");
        System.exit(0);
    } else {
        LOG.info("Application Master failed. exiting");
        System.exit(2);
    }
}

From source file:com.tito.easyyarn.appmaster.ApplicationMaster.java

License:Apache License

public static void main(String[] args) {
    boolean result = false;
    try {/*from  w  w  w  .  j  ava2s  .  co m*/
        Options ops = getMainClassOption();
        CommandLine cliParser = new ExtendedGnuParser(true).parse(ops, args);
        if (!cliParser.hasOption("appMasterClass")) {
            throw new RuntimeException("AppMasterClass is not specified failed to load Application Master");
        }

        ApplicationMaster appMaster = (ApplicationMaster) Class
                .forName(cliParser.getOptionValue("appMasterClass")).newInstance();

        LOG.info("Initializing ApplicationMaster");
        appMaster.setupOptionsAll();
        ////reparse args to assign options 
        cliParser = new ExtendedGnuParser(true).parse(appMaster.getOptions(), args);
        boolean doRun = appMaster.initAll(cliParser);

        if (!doRun) {
            System.exit(0);
        }
        appMaster.run();
        result = appMaster.finish();
    } catch (Throwable t) {
        LOG.fatal("Error running ApplicationMaster", t);
        LogManager.shutdown();
        ExitUtil.terminate(1, t);
    }
    if (result) {
        LOG.info("Application Master completed successfully. exiting");
        System.exit(0);
    } else {
        LOG.info("Application Master failed. exiting");
        System.exit(2);
    }
}

From source file:hadoop.yarn.distributedshell.DshellApplicationMaster.java

License:Apache License

/**
 * @param args/*from  w  ww .j a v a2s .co m*/
 *            Command line args
 */
public static void main(String[] args) {
    boolean result = false;
    try {
        DshellApplicationMaster appMaster = new DshellApplicationMaster();
        LOG.info("=====Initializing ApplicationMaster");
        boolean doRun = appMaster.init(args);
        if (!doRun) {
            System.exit(0);
        }
        appMaster.run();
        result = appMaster.finish();
    } catch (Throwable t) {
        LOG.fatal("Error running ApplicationMaster", t);
        LogManager.shutdown();
        ExitUtil.terminate(1, t);
    }
    if (result) {
        LOG.info("Application Master completed successfully. exiting");
        System.exit(0);
    } else {
        LOG.info("Application Master failed. exiting");
        System.exit(2);
    }
}

From source file:org.apache.hama.bsp.ApplicationMaster.java

License:Apache License

public static void main(String[] args) throws IOException {
    boolean result = false;
    ApplicationMaster appMaster = new ApplicationMaster();

    try {/*from www. j av  a2s  . com*/
        LOG.info("Initializing ApplicationMaster");
        boolean doRun = appMaster.init(args);
        if (!doRun) {
            System.exit(0);
        }
        appMaster.run();
        result = appMaster.finish();
    } catch (Throwable t) {
        LOG.fatal("Error running ApplicationMaster", t);
        LogManager.shutdown();
        ExitUtil.terminate(1, t);
    } finally {
        LOG.info("Stop SyncServer and RPCServer.");
        appMaster.close();
    }

    if (result) {
        LOG.info("Application Master completed successfully. exiting");
        System.exit(0);
    } else {
        LOG.info("Application Master failed. exiting");
        System.exit(2);
    }
}

From source file:org.apache.slider.core.main.ServiceLauncher.java

License:Apache License

/**
 * Exit the code./*  w ww  . j a  v a 2  s  .co m*/
 * This is method can be overridden for testing, throwing an 
 * exception instead. Any subclassed method MUST raise an 
 * {@link ExitUtil.ExitException} instance.
 * The service launcher code assumes that after this method is invoked,
 * no other code in the same method is called.
 * @param exitCode code to exit
 */
protected void exit(int exitCode, String message) {
    ExitUtil.terminate(exitCode, message);
}

From source file:org.apache.slider.core.main.ServiceLauncher.java

License:Apache License

/**
 * Exit off an exception. This can be subclassed for testing
 * @param ee exit exception
 */
protected void exit(ExitUtil.ExitException ee) {
    ExitUtil.terminate(ee.status, ee);
}

From source file:x10.x10rt.yarn.ApplicationMaster.java

License:Open Source License

public static void main(String[] args) {
    ApplicationMaster appMaster;/*  w w w  . java 2 s. c  o m*/
    try {
        LOG.info("Initializing ApplicationMaster");
        appMaster = new ApplicationMaster(args);
        appMaster.setup();
        appMaster.handleX10();
        appMaster.shutdown();
    } catch (Exception e) {
        LOG.warn("Error caught in main", e);
        ExitUtil.terminate(1, e);
    }
    System.exit(0);
}