Exploring JUC Scheduled, Tomcat, and Fork/Join Thread Pools

1. Scheduled Task Execution with JUC Thread Pools JUC's ScheduledExecutorService enables tasks to be executed at specific future times or with recurring delays. A common use case involves scheduling a task to run at a fixed point in time, such as every Thursday at 6:00 PM. To achieve this, first determine the initial delay until the next target ...

Posted on Sat, 10 Oct 2026 16:09:41 +0000 by sdallas411

Implementing a Delayed Task Scheduler in Java

Java provides multiple mechanisms for executing a task after a certain delay. One robust modern approach is to use ScheduledExecutorService, which offfers better thread management and flexibility than the traditional Timer class. This article demonstrates how to schedule a one‑shot delayed task using this executor. Overview: Scheduling a One‑Ti ...

Posted on Tue, 04 Aug 2026 17:01:08 +0000 by Adeus

ScheduledExecutorService CPU Spikes to 100% Due to Thread Pool Bug

When using ScheduledExecutorService with a core pool size of 0, a JDK bug can cause CPU usage to spike to 100%. This occurs due to an infinite loop in the getTask method of ThreadPoolExecutor when keepAliveTime is set to 0 nanoseconds. Problem Demonstration public static void main(String[] args) { ScheduledExecutorService executor = Executo ...

Posted on Thu, 04 Jun 2026 19:18:20 +0000 by skhale