List of usage examples for com.google.common.util.concurrent ThreadFactoryBuilder ThreadFactoryBuilder
public ThreadFactoryBuilder()
From source file:org.graylog2.system.jobs.SystemJobManager.java
private ScheduledExecutorService executorService(final MetricRegistry metricRegistry) { final ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("systemjob-executor-%d") .build();/*www .j a va 2 s . c o m*/ return new InstrumentedScheduledExecutorService( Executors.newScheduledThreadPool(THREAD_POOL_SIZE, threadFactory), metricRegistry, name(this.getClass(), "executor-service")); }
From source file:org.graylog2.restclient.lib.ServerNodesRefreshService.java
@Inject private ServerNodesRefreshService(ApiClient api, ServerNodes serverNodes, Node.Factory nodeFactory) { this.api = api; this.serverNodes = serverNodes; this.nodeFactory = nodeFactory; executor = Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder().setNameFormat("servernodes-refresh-%d").setDaemon(true).build()); }
From source file:org.eclipse.che.infrastructure.docker.client.CgroupOOMDetector.java
public CgroupOOMDetector(URI dockerDaemonUri, DockerConnector dockerConnector) { this.dockerDaemonUri = dockerDaemonUri; this.dockerConnector = dockerConnector; this.oomDetectors = new ConcurrentHashMap<>(); this.executor = Executors .newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("CgroupOOMDetector-%d") .setUncaughtExceptionHandler(LoggingUncaughtExceptionHandler.getInstance()).setDaemon(true) .build());// w w w. java 2 s . co m }
From source file:org.apache.hadoop.hive.llap.daemon.impl.QueryFileCleaner.java
public QueryFileCleaner(Configuration conf, FileSystem localFs) { super(QueryFileCleaner.class.getName()); int numCleanerThreads = conf.getInt(LlapConfiguration.LLAP_DAEMON_NUM_FILE_CLEANER_THREADS, LlapConfiguration.LLAP_DAEMON_NUM_FILE_CLEANER_THREADS_DEFAULT); ScheduledExecutorService rawExecutor = Executors.newScheduledThreadPool(numCleanerThreads, new ThreadFactoryBuilder().setDaemon(true).setNameFormat("QueryFileCleaner %d").build()); this.executorService = MoreExecutors.listeningDecorator(rawExecutor); this.localFs = localFs; }
From source file:com.yahoo.omid.tso.ReplyProcessorImpl.java
@Inject ReplyProcessorImpl(MetricsRegistry metrics, Panicker panicker) { replyRing = RingBuffer.<ReplyEvent>createMultiProducer(ReplyEvent.EVENT_FACTORY, 1 << 12, new BusySpinWaitStrategy()); SequenceBarrier replySequenceBarrier = replyRing.newBarrier(); BatchEventProcessor<ReplyEvent> replyProcessor = new BatchEventProcessor<ReplyEvent>(replyRing, replySequenceBarrier, this); replyProcessor.setExceptionHandler(new FatalExceptionHandler(panicker)); replyRing.addGatingSequences(replyProcessor.getSequence()); ExecutorService replyExec = Executors .newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("reply-%d").build()); replyExec.submit(replyProcessor);//from ww w.ja v a2s . co m abortMeter = metrics.meter(name("tso", "aborts")); commitMeter = metrics.meter(name("tso", "commits")); timestampMeter = metrics.meter(name("tso", "timestampAllocation")); }
From source file:com.google.gerrit.server.git.ReceiveCommitsExecutorModule.java
@Provides @Singleton/*w ww . j ava2s . co m*/ @ChangeUpdateExecutor public ListeningExecutorService createChangeUpdateExecutor(@GerritServerConfig Config config) { int poolSize = config.getInt("receive", null, "changeUpdateThreads", 1); if (poolSize <= 1) { return MoreExecutors.sameThreadExecutor(); } return MoreExecutors.listeningDecorator(MoreExecutors.getExitingExecutorService(new ThreadPoolExecutor(1, poolSize, 10, TimeUnit.MINUTES, new ArrayBlockingQueue<Runnable>(poolSize), new ThreadFactoryBuilder().setNameFormat("ChangeUpdate-%d").setDaemon(true).build(), new ThreadPoolExecutor.CallerRunsPolicy()))); }
From source file:com.groupon.mesos.util.ManagedEventBus.java
public ManagedEventBus(final String name) { checkNotNull(name, "name is null"); this.executor = Executors.newScheduledThreadPool(10, new ThreadFactoryBuilder().setDaemon(true).setNameFormat("eventbus-" + name + "-%d").build()); this.eventBus = new AsyncEventBus(executor, new EventBusExceptionHandler(name)); }
From source file:de.ks.eventsystem.bus.EventHandler.java
protected EventHandler(ExecutorService service, JavaFXExecutorService fxExecutor, Object target, Method method) {//w w w. j a v a2 s . c o m this.target = new WeakReference<>(target); this.method = method; if (method.isAnnotationPresent(Priority.class)) { Priority annotation = method.getAnnotation(Priority.class); priority = annotation.value(); } else { priority = Integer.MAX_VALUE; } if (method.isAnnotationPresent(Threading.class)) { handlingThread = method.getAnnotation(Threading.class).value(); } else { handlingThread = HandlingThread.Sync; } if (service == null) { ThreadFactory threadFactory = new ThreadFactoryBuilder()// .setDaemon(true)// .setNameFormat("Eventsystem-%d")// .setUncaughtExceptionHandler(new LoggingUncaughtExceptionHandler())// .build(); this.service = Executors.newCachedThreadPool(threadFactory); } else { this.service = service; } if (fxExecutor == null) { this.fxExecutor = new JavaFXExecutorService(); } else { this.fxExecutor = fxExecutor; } }
From source file:com.netflix.astyanax.util.WriteAheadMutationBatchExecutor.java
public WriteAheadMutationBatchExecutor(Keyspace keyspace, int nThreads) { this.executor = MoreExecutors.listeningDecorator( Executors.newFixedThreadPool(nThreads, new ThreadFactoryBuilder().setDaemon(true).build())); this.keyspace = keyspace; }
From source file:org.graylog2.inputs.syslog.SyslogUDPInput.java
private void spinUp() { final ExecutorService workerThreadPool = Executors .newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("input-syslogudp-worker-%d").build()); final ConnectionlessBootstrap bootstrap = new ConnectionlessBootstrap( new NioDatagramChannelFactory(workerThreadPool)); bootstrap.setOption("receiveBufferSizePredictorFactory", new FixedReceiveBufferSizePredictorFactory( graylogServer.getConfiguration().getUdpRecvBufferSizes())); bootstrap.setPipelineFactory(new SyslogPipelineFactory(graylogServer)); try {//w ww . ja v a 2s. c o m bootstrap.bind(socketAddress); LOG.info("Started UDP Syslog server on {}", socketAddress); } catch (ChannelException e) { LOG.error("Could not bind Syslog UDP server to address " + socketAddress, e); } }