Code example for ThreadFactoryBuilder

0
   * @param defaultParallel  whether to unannotated classes in parallel 
   * @param numThreads       number of parallel threads to use, must be positive. 
   */ 
  public ConcurrentRunnerScheduler(boolean defaultParallel, int numThreads) {
    this.defaultParallel = defaultParallel;
    ThreadFactory threadFactory = new ThreadFactoryBuilder()
        .setDaemon(true)
        .setNameFormat("concurrent-junit-runner-%d")
        .build();
    completionService = new ExecutorCompletionService<Void>(
        Executors.newFixedThreadPool(numThreads, threadFactory));
    concurrentTasks = new LinkedList<Future<Void>>();
    serialTasks = new LinkedList<Runnable>();
  } 
 
  @Override 
  public void schedule(Runnable childStatement) {
    serialTasks.offer(childStatement);
  } 
 
Experience pair programming with AI  Get Codota for Java