@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); }
final ForkJoinWorkerThreadFactory factory = new ForkJoinWorkerThreadFactory() { @Override public ForkJoinWorkerThread newThread(ForkJoinPool pool) { final ForkJoinWorkerThread worker = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool); worker.setName("my-thread-prefix-name-" + worker.getPoolIndex()); return worker; } }; forkJoinPool = new ForkJoinPool(Runtime.getRuntime().availableProcessors(), factory, null, false);
@Override public ForkJoinWorkerThread newThread(ForkJoinPool pool) { final ForkJoinWorkerThread worker = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool); worker.setName(namePrefix + worker.getPoolIndex()); return worker; } }
@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) { 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(threadPrefix + "-" + worker.getPoolIndex()); 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; } };
@Override public ForkJoinWorkerThread newThread(ForkJoinPool pool) { final ForkJoinWorkerThread worker = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool); worker.setName("TestFlow-" + worker.getPoolIndex()); return worker; } };
/** * Constructs a new instance of crawler. * * @param builder An instance of builder */ private Crawler(final Builder builder) { crawlerThread = new Thread(this::run, builder.name); exitWhenDone = new AtomicBoolean(false); fetcher = builder.fetcher; maxTries = builder.maxTries; propRetainProxy = builder.propRetainProxy; router = builder.router; scheduler = builder.scheduler; connections = new Semaphore(builder.maxConnections); session = builder.session; sleepScheduler = builder.sleepScheduler; threadPool = new ForkJoinPool(builder.parallelism, pool -> { final ForkJoinWorkerThread worker = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool); worker.setName(builder.name + " " + worker.getPoolIndex()); return worker; }, null, true ); workerManager = builder.workerManager == null ? new ThreadedWorkerManager(threadPool) : builder.workerManager; pendingJobs = Sets.newConcurrentHashSet(); handlerExceptions = Collections.synchronizedList(new ArrayList<>()); }
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); }
(config.getAsynchronousCorePoolSize(), pool -> { ForkJoinWorkerThread worker = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool); worker.setName(getThreadName() + worker.getPoolIndex()); return worker; }, null, true);
(config.getAsynchronousCorePoolSize(), pool -> { ForkJoinWorkerThread worker = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool); worker.setName(getThreadName() + worker.getPoolIndex()); return worker; }, null, true);