transaction-outbox icon indicating copy to clipboard operation
transaction-outbox copied to clipboard

ThreadPoolExecutor seems to be single thread by default.

Open luisalves00 opened this issue 2 years ago • 3 comments

After looking at the code I think you misspelled Math.min instead of Math.max:

/**
   * Schedules background worh with a {@link ThreadPoolExecutor}, sized to match {@link
   * ForkJoinPool#commonPool()} (or one thread, whichever is the larger), with a maximum queue size
   * of 16384 before work is discarded.
   *
   * @return The submitter.
   */
  static Submitter withDefaultExecutor() {
    // JDK bug means this warning can't be fixed
    //noinspection Convert2Diamond
    return withExecutor(
        new ThreadPoolExecutor(
            1,
            Math.min(1, ForkJoinPool.commonPool().getParallelism()),
            0L,
            TimeUnit.MILLISECONDS,
            new ArrayBlockingQueue<Runnable>(16384)));
  }

Can you please confirm.

luisalves00 avatar Aug 08 '22 14:08 luisalves00

Yup, that's a typo. I don't think many people are actually using that executor.

Will happily take a pull request.

badgerwithagun avatar Aug 08 '22 20:08 badgerwithagun

Done. When do you plan to do a release?

luisalves00 avatar Aug 09 '22 08:08 luisalves00

Very shortly. A day or two.

badgerwithagun avatar Aug 09 '22 20:08 badgerwithagun