Startup.java 文件源码

java
阅读 36 收藏 0 点赞 0 评论 0

项目:clustercode 作者:
public static void main(String[] args) throws Exception {

        List<String> logFiles = Arrays.asList("log4j2.xml", System.getenv("CC_LOG_CONFIG_FILE"));

        logFiles.forEach(name -> {
            if (name == null) return;
            Path logFile = Paths.get(name);
            if (Files.exists(logFile)) {
                System.setProperty("log4j.configurationFile", logFile.toAbsolutePath().toString());
            }
        });
        log = XLoggerFactory.getXLogger(Startup.class);

        Thread.setDefaultUncaughtExceptionHandler((thread, throwable) -> {
            // Normally the exceptions will be caught, but to debug any unexpected ones we log them (again).
            log.error("Application-wide uncaught exception:", throwable);
            System.exit(1);
        });

        log.info("Working dir: {}", new File("").getAbsolutePath());

        Properties config = getProperties(args.length >= 1 ? args[0] : null);

        GuiceContainer container = new GuiceContainer(config);

        container.getInstance(RestApiServices.class).start();
        container.getInstance(StateMachineService.class).initialize();
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号