Java Executors newScheduledThreadPool() MethodLast Updated : 17 Mar 2025 The newScheduledThreadPool() method of Executors class creates a thread pool that can schedule commands to run after a given delay or to execute periodically. SyntaxParametercorePoolSize - the number of threads to keep in the pool, even if they are idle threadFactory - the factory to use when the executor creates a new thread Returnsa newly created scheduled thread pool ThrowNullPointerException IllegalArgumentException Example 1Output: class java.util.concurrent.ScheduledThreadPoolExecutor size of mypool: 0 Thread Name: pool-2-thread-1 after sleep Thread Name: pool-2-thread-1 Example 2Output: class java.util.concurrent.ScheduledThreadPoolExecutor size of mypool: 0 false class java.util.concurrent.ScheduledThreadPoolExecutor Next TopicJava Executors |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India