类com.google.common.util.concurrent.UncaughtExceptionHandlers源码实例Demo

下面列出了怎么用com.google.common.util.concurrent.UncaughtExceptionHandlers的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: grpc-nebula-java   文件: LoadServer.java
ExecutorService getExecutor(int asyncThreads) {
  // TODO(carl-mastrangelo): This should not be necessary.  I don't know where this should be
  // put.  Move it somewhere else, or remove it if no longer necessary.
  // See: https://github.com/grpc/grpc-java/issues/2119
  return new ForkJoinPool(asyncThreads,
      new ForkJoinWorkerThreadFactory() {
        final AtomicInteger num = new AtomicInteger();
        @Override
        public ForkJoinWorkerThread newThread(ForkJoinPool pool) {
          ForkJoinWorkerThread thread = defaultForkJoinWorkerThreadFactory.newThread(pool);
          thread.setDaemon(true);
          thread.setName("server-worker-" + "-" + num.getAndIncrement());
          return thread;
        }
      }, UncaughtExceptionHandlers.systemExit(), true /* async */);
}
 
源代码2 项目: grpc-java   文件: LoadServer.java
ExecutorService getExecutor(int asyncThreads) {
  // TODO(carl-mastrangelo): This should not be necessary.  I don't know where this should be
  // put.  Move it somewhere else, or remove it if no longer necessary.
  // See: https://github.com/grpc/grpc-java/issues/2119
  return new ForkJoinPool(asyncThreads,
      new ForkJoinWorkerThreadFactory() {
        final AtomicInteger num = new AtomicInteger();
        @Override
        public ForkJoinWorkerThread newThread(ForkJoinPool pool) {
          ForkJoinWorkerThread thread = defaultForkJoinWorkerThreadFactory.newThread(pool);
          thread.setDaemon(true);
          thread.setName("server-worker-" + "-" + num.getAndIncrement());
          return thread;
        }
      }, UncaughtExceptionHandlers.systemExit(), true /* async */);
}
 
源代码3 项目: data-transfer-project   文件: WorkerMain.java
public static void main(String[] args) {
  Thread.setDefaultUncaughtExceptionHandler(UncaughtExceptionHandlers.systemExit());

  WorkerMain workerMain = new WorkerMain();
  workerMain.initialize();
  workerMain.poll();

  System.exit(0);
}
 
源代码4 项目: data-transfer-project   文件: SingleVMMain.java
public static void main(String[] args) {
  Thread.setDefaultUncaughtExceptionHandler(UncaughtExceptionHandlers.systemExit());

  SingleVMMain singleVMMain = new SingleVMMain();

  Runtime.getRuntime().addShutdownHook(new Thread(singleVMMain::shutdown));

  // TODO make number of workers configurable
  singleVMMain.initializeWorkers(1);
  singleVMMain.initializeGateway();
}
 
源代码5 项目: hadoop   文件: IPCLoggerChannel.java
/**
 * Separated out for easy overriding in tests.
 */
@VisibleForTesting
protected ExecutorService createSingleThreadExecutor() {
  return Executors.newSingleThreadExecutor(
      new ThreadFactoryBuilder()
        .setDaemon(true)
        .setNameFormat("Logger channel (from single-thread executor) to " +
            addr)
        .setUncaughtExceptionHandler(
            UncaughtExceptionHandlers.systemExit())
        .build());
}
 
源代码6 项目: hadoop   文件: IPCLoggerChannel.java
/**
 * Separated out for easy overriding in tests.
 */
@VisibleForTesting
protected ExecutorService createParallelExecutor() {
  return Executors.newCachedThreadPool(
      new ThreadFactoryBuilder()
          .setDaemon(true)
          .setNameFormat("Logger channel (from parallel executor) to " + addr)
          .setUncaughtExceptionHandler(
              UncaughtExceptionHandlers.systemExit())
          .build());
}
 
源代码7 项目: big-c   文件: IPCLoggerChannel.java
/**
 * Separated out for easy overriding in tests.
 */
@VisibleForTesting
protected ExecutorService createSingleThreadExecutor() {
  return Executors.newSingleThreadExecutor(
      new ThreadFactoryBuilder()
        .setDaemon(true)
        .setNameFormat("Logger channel (from single-thread executor) to " +
            addr)
        .setUncaughtExceptionHandler(
            UncaughtExceptionHandlers.systemExit())
        .build());
}
 
源代码8 项目: big-c   文件: IPCLoggerChannel.java
/**
 * Separated out for easy overriding in tests.
 */
@VisibleForTesting
protected ExecutorService createParallelExecutor() {
  return Executors.newCachedThreadPool(
      new ThreadFactoryBuilder()
          .setDaemon(true)
          .setNameFormat("Logger channel (from parallel executor) to " + addr)
          .setUncaughtExceptionHandler(
              UncaughtExceptionHandlers.systemExit())
          .build());
}
 
源代码9 项目: greenbeans   文件: WebServerRunner.java
public static void main(String[] args) throws Exception {
	Thread.currentThread().setUncaughtExceptionHandler(UncaughtExceptionHandlers.systemExit());

	maybeEnableDemo();

	Server server = new Server(PORT);

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

	addJerseyServlet(contextHandler);
	addCorHeadersFilter(contextHandler);

	server.start();
	server.join();
}
 
 同包方法