Example usage for java.lang Shutdown exit

List of usage examples for java.lang Shutdown exit

Introduction

In this page you can find the example usage for java.lang Shutdown exit.

Prototype

static void exit(int status) 

Source Link

Usage

From source file:com.l2jfree.L2Config.java

protected static void initApplication(String configPackageName,
        Class<? extends ThreadPoolInitializer> threadPoolInitializerClass,
        Class<? extends DataSourceInitializer> dataSourceInitializerClass) {
    Util.printSection("Config");

    try {/*from w  w  w  .  j a v  a2 s.co m*/
        L2Config.registerConfigClasses(configPackageName);
    } catch (Exception e) {
        _log.fatal("Could not load configuration classes!", e);
        Shutdown.exit(TerminationStatus.RUNTIME_INVALID_CONFIGURATION);
    }

    try {
        L2Config.loadConfigs();
    } catch (Exception e) {
        _log.fatal("Could not load configuration files!", e);
        Shutdown.exit(TerminationStatus.RUNTIME_INVALID_CONFIGURATION);
    }

    Util.printSection("Thread Pool");

    try {
        L2ThreadPool.initThreadPools(threadPoolInitializerClass.newInstance());
    } catch (Exception e) {
        _log.fatal("Could not initialize thread pools!", e);
        Shutdown.exit(TerminationStatus.RUNTIME_INITIALIZATION_FAILURE);
    }

    if (dataSourceInitializerClass != null) {
        Util.printSection("Database");

        try {
            L2Database.setDataSource("default", dataSourceInitializerClass.newInstance());
        } catch (Exception e) {
            _log.fatal("Could not initialize DB connections!", e);
            Shutdown.exit(TerminationStatus.RUNTIME_INITIALIZATION_FAILURE);
        }

        Util.printSection("Database Installer");

        try {
            L2DatabaseInstaller.check();
        } catch (Exception e) {
            _log.fatal("Could not initialize DB tables!", e);
            Shutdown.exit(TerminationStatus.RUNTIME_INITIALIZATION_FAILURE);
        }
    }

    Util.printSection("Utility");

    Shutdown.initShutdownHook();

    DeadlockDetector.getInstance();
}