use of com.adeptj.runtime.common.ShutdownHook in project adeptj-runtime by AdeptJ.
the class Launcher method main.
/**
* Entry point for initializing the AdeptJ Runtime.
* <p>
* It does the following tasks in order.
* <p>
* 1. Initializes the Logback logging framework.
* 2. Does the deployment to embedded UNDERTOW.
* 3. Starts the OSGi Framework.
* 4. Starts the Undertow server.
* 5. Registers the runtime ShutdownHook.
*
* @param args command line arguments for the Launcher.
*/
public static void main(String[] args) {
Thread.currentThread().setName("AdeptJ Launcher");
long startTime = System.nanoTime();
Logger logger = LoggerFactory.getLogger(Launcher.class);
Launcher launcher = new Launcher();
try {
logger.info("JRE: [{}], Version: [{}]", JAVA_RUNTIME_NAME, JAVA_RUNTIME_VERSION);
Lifecycle lifecycle = new Server();
lifecycle.start(args);
Runtime.getRuntime().addShutdownHook(new ShutdownHook(lifecycle, SERVER_STOP_THREAD_NAME));
logger.info("AdeptJ Runtime initialized in [{}] ms!!", Times.elapsedMillis(startTime));
} catch (Throwable th) {
// NOSONAR
logger.error("Exception while initializing AdeptJ Runtime!!", th);
launcher.cleanup(logger);
}
}
Aggregations