Back to Intellij Community

ScheduledThreadPoolExecutorWithZeroCoreThreads

java/java-impl/resources/inspectionDescriptions/ScheduledThreadPoolExecutorWithZeroCoreThreads.html

2025.3-rc-2489 B
Original Source

Reports any java.util.concurrent.ScheduledThreadPoolExecutor instances in which corePoolSize is set to zero via the setCorePoolSize method or the object constructor.

A ScheduledThreadPoolExecutor with zero core threads will run nothing.

Example:

void foo(int corePoolSize) {
      if (corePoolSize != 0) return;
      ThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(corePoolSize); // warning
      executor.setCorePoolSize(corePoolSize); // warning
  }