Tagged articles
2 articles
Page 1 of 1
FunTester
FunTester
May 6, 2024 · Backend Development

Building a Multi‑Priority Thread Pool with Java's PriorityBlockingQueue

This article explains how to solve Java thread‑pool priority problems by leveraging java.util.concurrent.PriorityBlockingQueue, details its thread‑safe and unbounded features, and provides a complete multi‑priority thread‑pool implementation with sample code and a test demonstrating correct task ordering.

JavaPriority SchedulingPriorityBlockingQueue
0 likes · 6 min read
Building a Multi‑Priority Thread Pool with Java's PriorityBlockingQueue
Programmer DD
Programmer DD
Aug 8, 2018 · Fundamentals

Unlocking Java’s PriorityBlockingQueue: How Binary Heap Powers Priority Queues

This article explains how Java’s PriorityBlockingQueue implements a priority‑based unbounded blocking queue using a binary heap, covering heap structure, insertion and removal algorithms, underlying ReentrantLock synchronization, and key source code snippets that illustrate the sift‑up, sift‑down, and growth mechanisms.

BinaryHeapDataStructureJava
0 likes · 16 min read
Unlocking Java’s PriorityBlockingQueue: How Binary Heap Powers Priority Queues