Example usage for com.google.common.util.concurrent UncaughtExceptionHandlers systemExit

List of usage examples for com.google.common.util.concurrent UncaughtExceptionHandlers systemExit

Introduction

In this page you can find the example usage for com.google.common.util.concurrent UncaughtExceptionHandlers systemExit.

Prototype

public static UncaughtExceptionHandler systemExit() 

Source Link

Document

Returns an exception handler that exits the system.

Usage

From source file:com.greensopinion.finance.services.web.WebServerRunner.java

public static void main(String[] args) throws Exception {
    Thread.currentThread().setUncaughtExceptionHandler(UncaughtExceptionHandlers.systemExit());

    maybeEnableDemo();/*from  ww w.  j ava2  s  . c  o  m*/

    Server server = new Server(PORT);

    ServletContextHandler contextHandler = new ServletContextHandler(server, "/");
    addDefaultServlet(contextHandler);

    addJerseyServlet(contextHandler);
    addCorHeadersFilter(contextHandler);

    server.start();
    server.join();
}

From source file:org.apache.hadoop.hdfs.qjournal.client.IPCLoggerChannel.java

/**
 * Separated out for easy overriding in tests.
 *///w  w w .java2s  . c o  m
@VisibleForTesting
protected ExecutorService createSingleThreadExecutor() {
    return Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setDaemon(true)
            .setNameFormat("Logger channel (from single-thread executor) to " + addr)
            .setUncaughtExceptionHandler(UncaughtExceptionHandlers.systemExit()).build());
}

From source file:org.apache.hadoop.hdfs.qjournal.client.IPCLoggerChannel.java

/**
 * Separated out for easy overriding in tests.
 *///from ww w . j av  a2s. c  o m
@VisibleForTesting
protected ExecutorService createParallelExecutor() {
    return Executors.newCachedThreadPool(new ThreadFactoryBuilder().setDaemon(true)
            .setNameFormat("Logger channel (from parallel executor) to " + addr)
            .setUncaughtExceptionHandler(UncaughtExceptionHandlers.systemExit()).build());
}