Java Code Examples for java.util.concurrent.ForkJoinPool#defaultForkJoinWorkerThreadFactory()

The following examples show how to use java.util.concurrent.ForkJoinPool#defaultForkJoinWorkerThreadFactory() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WakeSharedPool.java    From reef with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example 2
Source File: AbstractJavaScheduler.java    From LuckPerms with MIT License 5 votes vote down vote up
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);
}
 
Example 3
Source File: ForkJoinTask8Test.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private static ForkJoinPool asyncSingletonPool() {
    return new ForkJoinPool(1,
                            ForkJoinPool.defaultForkJoinWorkerThreadFactory,
                            null, true);
}
 
Example 4
Source File: CountedCompleterTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private static ForkJoinPool asyncSingletonPool() {
    return new ForkJoinPool(1,
                            ForkJoinPool.defaultForkJoinWorkerThreadFactory,
                            null, true);
}
 
Example 5
Source File: RecursiveTaskTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private static ForkJoinPool asyncSingletonPool() {
    return new ForkJoinPool(1,
                            ForkJoinPool.defaultForkJoinWorkerThreadFactory,
                            null, true);
}
 
Example 6
Source File: RecursiveActionTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private static ForkJoinPool asyncSingletonPool() {
    return new ForkJoinPool(1,
                            ForkJoinPool.defaultForkJoinWorkerThreadFactory,
                            null, true);
}
 
Example 7
Source File: ForkJoinTaskTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private static ForkJoinPool asyncSingletonPool() {
    return new ForkJoinPool(1,
                            ForkJoinPool.defaultForkJoinWorkerThreadFactory,
                            null, true);
}
 
Example 8
Source File: Issue0076.java    From spotbugs with GNU Lesser General Public License v2.1 4 votes vote down vote up
@NoWarning("NP_NONNULL_PARAM_VIOLATION")
public void testNominal() {
    new ForkJoinPool(2, ForkJoinPool.defaultForkJoinWorkerThreadFactory, null, true);
}
 
Example 9
Source File: ForkJoinTask8Test.java    From j2objc with Apache License 2.0 4 votes vote down vote up
private static ForkJoinPool asyncSingletonPool() {
    return new ForkJoinPool(1,
                            ForkJoinPool.defaultForkJoinWorkerThreadFactory,
                            null, true);
}
 
Example 10
Source File: CountedCompleterTest.java    From j2objc with Apache License 2.0 4 votes vote down vote up
private static ForkJoinPool asyncSingletonPool() {
    return new ForkJoinPool(1,
                            ForkJoinPool.defaultForkJoinWorkerThreadFactory,
                            null, true);
}
 
Example 11
Source File: RecursiveTaskTest.java    From j2objc with Apache License 2.0 4 votes vote down vote up
private static ForkJoinPool asyncSingletonPool() {
    return new ForkJoinPool(1,
                            ForkJoinPool.defaultForkJoinWorkerThreadFactory,
                            null, true);
}
 
Example 12
Source File: RecursiveActionTest.java    From j2objc with Apache License 2.0 4 votes vote down vote up
private static ForkJoinPool asyncSingletonPool() {
    return new ForkJoinPool(1,
                            ForkJoinPool.defaultForkJoinWorkerThreadFactory,
                            null, true);
}
 
Example 13
Source File: ForkJoinTaskTest.java    From j2objc with Apache License 2.0 4 votes vote down vote up
private static ForkJoinPool asyncSingletonPool() {
    return new ForkJoinPool(1,
                            ForkJoinPool.defaultForkJoinWorkerThreadFactory,
                            null, true);
}