下面列出了java.util.concurrent.ForkJoinPool#defaultForkJoinWorkerThreadFactory ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Inject
public WakeSharedPool(@Parameter(Parallelism.class) final int parallelism) {
this.pool = new ForkJoinPool(parallelism, ForkJoinPool.defaultForkJoinWorkerThreadFactory,
new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(final Thread t, final Throwable e) {
// TODO[JIRA REEF-911]: need to pass this upwards to REEF can grab it
}
},
// async mode turned on so a task that invokes other tasks does not have to join on them.
// this is appropriate for event-based tasks, where once you submit an event to a stage it
// is always fire-and-forget.
true);
// register it with the StageManager, since the pool is meant to back stages
StageManager.instance().register(this);
}
public AbstractJavaScheduler() {
this.scheduler = new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder()
.setDaemon(true)
.setNameFormat("luckperms-scheduler")
.build()
);
this.scheduler.setRemoveOnCancelPolicy(true);
this.schedulerWorkerPool = new ErrorReportingExecutor(Executors.newCachedThreadPool(new ThreadFactoryBuilder()
.setDaemon(true)
.setNameFormat("luckperms-scheduler-worker-%d")
.build()
));
this.worker = new ForkJoinPool(32, ForkJoinPool.defaultForkJoinWorkerThreadFactory, (t, e) -> e.printStackTrace(), false);
}
private static ForkJoinPool asyncSingletonPool() {
return new ForkJoinPool(1,
ForkJoinPool.defaultForkJoinWorkerThreadFactory,
null, true);
}
private static ForkJoinPool asyncSingletonPool() {
return new ForkJoinPool(1,
ForkJoinPool.defaultForkJoinWorkerThreadFactory,
null, true);
}
private static ForkJoinPool asyncSingletonPool() {
return new ForkJoinPool(1,
ForkJoinPool.defaultForkJoinWorkerThreadFactory,
null, true);
}
private static ForkJoinPool asyncSingletonPool() {
return new ForkJoinPool(1,
ForkJoinPool.defaultForkJoinWorkerThreadFactory,
null, true);
}
private static ForkJoinPool asyncSingletonPool() {
return new ForkJoinPool(1,
ForkJoinPool.defaultForkJoinWorkerThreadFactory,
null, true);
}
@NoWarning("NP_NONNULL_PARAM_VIOLATION")
public void testNominal() {
new ForkJoinPool(2, ForkJoinPool.defaultForkJoinWorkerThreadFactory, null, true);
}
private static ForkJoinPool asyncSingletonPool() {
return new ForkJoinPool(1,
ForkJoinPool.defaultForkJoinWorkerThreadFactory,
null, true);
}
private static ForkJoinPool asyncSingletonPool() {
return new ForkJoinPool(1,
ForkJoinPool.defaultForkJoinWorkerThreadFactory,
null, true);
}
private static ForkJoinPool asyncSingletonPool() {
return new ForkJoinPool(1,
ForkJoinPool.defaultForkJoinWorkerThreadFactory,
null, true);
}
private static ForkJoinPool asyncSingletonPool() {
return new ForkJoinPool(1,
ForkJoinPool.defaultForkJoinWorkerThreadFactory,
null, true);
}
private static ForkJoinPool asyncSingletonPool() {
return new ForkJoinPool(1,
ForkJoinPool.defaultForkJoinWorkerThreadFactory,
null, true);
}