@Override public ForkJoinWorkerThread newThread(ForkJoinPool pool) { // Note: The ForkJoinPool will create these threads as daemon threads. ForkJoinWorkerThread thread = new InternalForkJoinWorkerThread(pool); thread.setName(namePrefix + '-' + idx.getAndIncrement()); return thread; } }
private static ForkJoinWorkerThreadFactory fjwtf(final String name) { AtomicLong id = new AtomicLong(); return pool -> { ForkJoinWorkerThread thread = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool); thread.setName(name + "-" + id.incrementAndGet()); return thread; }; }
@Override public ForkJoinWorkerThread newThread(ForkJoinPool pool) { // Note: The ForkJoinPool will create these threads as daemon threads. ForkJoinWorkerThread thread = new InternalForkJoinWorkerThread(pool); thread.setName(namePrefix + '-' + idx.getAndIncrement()); return thread; } }
@Override public ForkJoinWorkerThread newThread( ForkJoinPool pool ) { // We do this complicated dance of allocating the ForkJoinThread in a separate thread, // because there is no way to give it a specific ThreadGroup, other than through inheritance // from the allocating thread. ForkJoinPool.ForkJoinWorkerThreadFactory factory = ForkJoinPool.defaultForkJoinWorkerThreadFactory; AtomicReference<ForkJoinWorkerThread> reference = new AtomicReference<>(); Thread allocator = newThread( () -> reference.set( factory.newThread( pool ) ) ); allocator.start(); do { try { allocator.join(); } catch ( InterruptedException ignore ) { } } while ( reference.get() == null ); ForkJoinWorkerThread worker = reference.get(); worker.setName( group.threadName() ); return worker; } }
@Override public ForkJoinWorkerThread newThread(ForkJoinPool pool) { final ForkJoinWorkerThread worker = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool); worker.setName("dogged-cubing-cuboid-worker-" + worker.getPoolIndex()); return worker; } };
public static ExecutorService newScalingThreadPool(final int maxThreads) { final ForkJoinPool.ForkJoinWorkerThreadFactory factory = pool -> { final ForkJoinWorkerThread worker = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool); worker.setName("OrbitThread-" + worker.getPoolIndex()); return worker; }; return new ForkJoinPool(maxThreads, factory, (t, e) -> logger.log(Level.SEVERE, "Uncaught exception", e), false); } }
public static ExecutorService newWorkStealingPool(String threadName, int maxParallelThreads) { final ForkJoinWorkerThreadFactory factory = pool -> { ForkJoinWorkerThread worker = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool); LoggingUncaughtExceptionHandler.setOnThread(worker); worker.setName(threadName + worker.getPoolIndex()); return worker; }; return new ForkJoinPool(maxParallelThreads, factory, null, true); }
releasePlock(nps); wt.setName(workerNamePrefix.concat(Integer.toString(w.poolIndex))); return w;
@Inject public ScheduledEmailService( @Named("ui.metadata.jdbc") JDBCPoolDataSource dataSource, LockService lockService, WebUserHttpService webUserHttpService, RakamUIConfig rakamUIConfig, EmailClientConfig emailConfig) { dbi = new DBI(dataSource); this.lockService = lockService; this.webUserHttpService = webUserHttpService; this.screenCaptureService = rakamUIConfig.getScreenCaptureService(); this.mailSender = emailConfig.getMailSender(); this.siteHost = emailConfig.getSiteUrl().getHost() + (emailConfig.getSiteUrl().getPort() == -1 ? "" : (":" + emailConfig.getSiteUrl().getPort())); this.scheduler = Executors.newScheduledThreadPool(1, new ThreadFactoryBuilder() .setNameFormat("scheduled-email-scheduler") .setUncaughtExceptionHandler((t, e) -> LOGGER.error(e)) .build()); executorService = MoreExecutors.listeningDecorator(new ForkJoinPool (Runtime.getRuntime().availableProcessors(), pool -> { ForkJoinWorkerThread forkJoinWorkerThread = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool); forkJoinWorkerThread.setName("scheduled-email-task-worker"); return forkJoinWorkerThread; }, null, true)); }
/** * {@inheritDoc} * <p> * Returns new Thread with set name. */ @Override public ForkJoinWorkerThread newThread(ForkJoinPool pool) { ForkJoinWorkerThread workerThread = new WorkerThread(pool); workerThread.setName(threadNamePrefix + "-" + ++threadCounter); return workerThread; }
@Override public ForkJoinWorkerThread newThread(ForkJoinPool pool) { // Note: The ForkJoinPool will create these threads as daemon threads. ForkJoinWorkerThread thread = new InternalForkJoinWorkerThread(pool); thread.setName(namePrefix + '-' + idx.getAndIncrement()); return thread; } }
private static ForkJoinWorkerThreadFactory fjwtf(final String name) { AtomicLong id = new AtomicLong(); return pool -> { ForkJoinWorkerThread thread = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool); thread.setName(name + "-" + id.incrementAndGet()); return thread; }; }
@Override public ForkJoinWorkerThread newThread(ForkJoinPool pool) { final ForkJoinWorkerThread worker = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool); worker.setName("BotTrace-" + worker.getPoolIndex()); return worker; } };
@Override public ForkJoinWorkerThread newThread(ForkJoinPool pool) { final ForkJoinWorkerThread worker = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool); worker.setName("TestFlow-" + worker.getPoolIndex()); return worker; } };
@Override public ForkJoinWorkerThread newThread(ForkJoinPool pool) { ForkJoinWorkerThread thread = createThread(pool); // ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool); final String workerNumber = thread.getName().substring(thread.getName().lastIndexOf('-') + 1); final String newThreadName = "ForkJoinPool-" + name + "-worker-" + workerNumber; thread.setName(newThreadName); //thread.setUncaughtExceptionHandler(uncaughtExceptionHandler); return thread; }
@Override public ForkJoinWorkerThread newThread(ForkJoinPool pool) { ForkJoinWorkerThread t = new FJWT(pool); t.setName("ForkJoinScheduler(parallelism=" + size + ")-" + (++i)); t.setPriority(Thread.NORM_PRIORITY); t.setDaemon(true); return t; } }, null, true));
@Override public ForkJoinWorkerThread newThread(ForkJoinPool pool) { final ForkJoinWorkerThread worker = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool); worker.setName(threadPrefix + "-" + worker.getPoolIndex()); return worker; } }
@Override public ForkJoinWorkerThread newThread(ForkJoinPool pool) { final ForkJoinWorkerThread worker = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool); worker.setName(namePrefix + worker.getPoolIndex()); return worker; } }
public SimpleHTTPServer(SimpleHTTPServerConfiguration configuration) { this.configuration = configuration; requestMeter = this.configuration.getTcpConfiguration() .getMetricReporterFactory() .getMetricRegistry() .meter("http2.SimpleHTTPServer.request.count"); handlerExecutorService = new ForkJoinPool(defaultPoolSize, pool -> { ForkJoinWorkerThread workerThread = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool); workerThread.setName("firefly-http-server-handler-pool-" + workerThread.getPoolIndex()); return workerThread; }, null, true); }
public SimpleHTTPServer(SimpleHTTPServerConfiguration configuration) { this.configuration = configuration; requestMeter = this.configuration.getTcpConfiguration() .getMetricReporterFactory() .getMetricRegistry() .meter("http2.SimpleHTTPServer.request.count"); handlerExecutorService = new ForkJoinPool(defaultPoolSize, pool -> { ForkJoinWorkerThread workerThread = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool); workerThread.setName("firefly-http-server-handler-pool-" + workerThread.getPoolIndex()); return workerThread; }, null, true); }