Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use LinkedBlockingQueue instead of LinkedTransferQueue for ThreadPool…
…Executor Motivation: The use of `LinkedTransferQueue` in JDK 17 has a bug causing a thread to consume all of a CPU's usage: https://bugs.openjdk.org/browse/JDK-8301341. Although this bug has been fixed, the patch has not been backported to JDK 17. Since copying the code from JDK 11 poses licensing issues (openhab/openhab-core#3756), we need a different solution. Switching to `LinkedBlockingQueue` offers a feasible workaround. While `LinkedTransferQueue` is typically efficient under high multi-thread contention due to its use of CAS, our current usage does not exhibit significant contention as the queue tasks' size remains close to 0. Modifications: - Replaced the use of `LinkedTransferQueue` with `LinkedBlockingQueue` in `ThreadPoolExecutor`. Result: - You no longer see an excessive CPU usage by a single thread.
- Loading branch information