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

项目: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 */);
}
项目:grpc-java    文件:Utils.java   
private static synchronized ExecutorService getExecutor() {
  if (clientExecutor == null) {
    clientExecutor = new ForkJoinPool(
        Runtime.getRuntime().availableProcessors(),
        new ForkJoinWorkerThreadFactory() {
          final AtomicInteger num = new AtomicInteger();
          @Override
          public ForkJoinWorkerThread newThread(ForkJoinPool pool) {
            ForkJoinWorkerThread thread = defaultForkJoinWorkerThreadFactory.newThread(pool);
            thread.setDaemon(true);
            thread.setName("grpc-client-app-" + "-" + num.getAndIncrement());
            return thread;
          }
        }, UncaughtExceptionHandlers.systemExit(), true /* async */);
  }
  return clientExecutor;
}
项目:zookeeper-lite    文件:DefaultMain.java   
@Override
public void run() {
    Thread.currentThread().setUncaughtExceptionHandler(UncaughtExceptionHandlers.systemExit());
    Application application = this.application.get();
    if (runtime.getConfiguration().getArguments().getProgramName().isEmpty()) {
        runtime.getConfiguration().getArguments().setProgramName(application.getClass().getName());
    }
    exitIfHelpSet(runtime.getConfiguration().getArguments());
    logger.info("{}", runtime.getConfiguration().getConfig());
    Runtime.getRuntime().addShutdownHook(new Thread() {
        @Override
        public void run() {
            runtime.shutdown();
        }
    });
    application.run();
    logger.info("Exiting");
}
项目: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());
}
项目: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());
}
项目:aliyun-oss-hadoop-fs    文件: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());
}
项目:aliyun-oss-hadoop-fs    文件: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());
}
项目: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());
}
项目: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());
}
项目:hadoop-2.6.0-cdh5.4.3    文件: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());
}
项目:hadoop-2.6.0-cdh5.4.3    文件: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());
}
项目:hadoop-EAR    文件:IPCLoggerChannel.java   
/**
 * Separated out for easy overriding in tests.
 */
@VisibleForTesting
protected ExecutorService createExecutor() {
  return Executors.newSingleThreadExecutor(
      new ThreadFactoryBuilder()
        .setDaemon(true)
        .setNameFormat("Logger channel to " + addr)
        .setUncaughtExceptionHandler(
            UncaughtExceptionHandlers.systemExit())
        .build());
}
项目:hadoop-plus    文件:IPCLoggerChannel.java   
/**
 * Separated out for easy overriding in tests.
 */
@VisibleForTesting
protected ExecutorService createExecutor() {
  return Executors.newSingleThreadExecutor(
      new ThreadFactoryBuilder()
        .setDaemon(true)
        .setNameFormat("Logger channel to " + addr)
        .setUncaughtExceptionHandler(
            UncaughtExceptionHandlers.systemExit())
        .build());
}
项目:FlexMap    文件: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());
}
项目:FlexMap    文件: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());
}
项目:hadoop-TCP    文件:IPCLoggerChannel.java   
/**
 * Separated out for easy overriding in tests.
 */
@VisibleForTesting
protected ExecutorService createExecutor() {
  return Executors.newSingleThreadExecutor(
      new ThreadFactoryBuilder()
        .setDaemon(true)
        .setNameFormat("Logger channel to " + addr)
        .setUncaughtExceptionHandler(
            UncaughtExceptionHandlers.systemExit())
        .build());
}
项目:hardfs    文件:IPCLoggerChannel.java   
/**
 * Separated out for easy overriding in tests.
 */
@VisibleForTesting
protected ExecutorService createExecutor() {
  return Executors.newSingleThreadExecutor(
      new ThreadFactoryBuilder()
        .setDaemon(true)
        .setNameFormat("Logger channel to " + addr)
        .setUncaughtExceptionHandler(
            UncaughtExceptionHandlers.systemExit())
        .build());
}
项目:hadoop-on-lustre2    文件:IPCLoggerChannel.java   
/**
 * Separated out for easy overriding in tests.
 */
@VisibleForTesting
protected ExecutorService createExecutor() {
  return Executors.newSingleThreadExecutor(
      new ThreadFactoryBuilder()
        .setDaemon(true)
        .setNameFormat("Logger channel to " + addr)
        .setUncaughtExceptionHandler(
            UncaughtExceptionHandlers.systemExit())
        .build());
}
项目:gletscher    文件:GletscherMain.java   
RealCommandContext() {
  ThreadFactory threadFactory =
      new ThreadFactoryBuilder()
          .setNameFormat("gletscher-pool-%d")
          .setUncaughtExceptionHandler(UncaughtExceptionHandlers.systemExit())
          .build();
  executor =
      MoreExecutors.listeningDecorator(
          new ThreadPoolExecutor(
              4, 32, 1, TimeUnit.MINUTES, new LinkedBlockingQueue<>(1024), threadFactory));
}
项目: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();
}