<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Blocking-Queue on Kevin wang's blog</title><link>https://kevinwang930.github.io/tags/blocking-queue/</link><description>Recent content in Blocking-Queue on Kevin wang's blog</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Sun, 05 Jul 2026 00:00:00 +0800</lastBuildDate><atom:link href="https://kevinwang930.github.io/tags/blocking-queue/index.xml" rel="self" type="application/rss+xml"/><item><title>java concurrency - BlockingQueue</title><link>https://kevinwang930.github.io/post/java/concurrency/blocking-queue/</link><pubDate>Sun, 05 Jul 2026 00:00:00 +0800</pubDate><guid>https://kevinwang930.github.io/post/java/concurrency/blocking-queue/</guid><description>&lt;p&gt;&lt;code&gt;java.util.concurrent.BlockingQueue&lt;/code&gt; extends &lt;code&gt;Queue&lt;/code&gt; with &lt;strong&gt;blocking insertion and retrieval&lt;/strong&gt;: a producer invoking &lt;code&gt;put&lt;/code&gt; suspends when capacity is exhausted; a consumer invoking &lt;code&gt;take&lt;/code&gt; suspends when no element is available. All JDK implementations are thread-safe and intended for producer–consumer pipelines; their primary deployment is as the &lt;code&gt;workQueue&lt;/code&gt; of &lt;code&gt;ThreadPoolExecutor&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;This article examines the OpenJDK implementations: the dual-condition bounded-buffer pattern, the two-lock design of &lt;code&gt;LinkedBlockingQueue&lt;/code&gt;, the heap-backed &lt;code&gt;PriorityBlockingQueue&lt;/code&gt;, the zero-capacity rendezvous semantics of &lt;code&gt;SynchronousQueue&lt;/code&gt;, and the timed waiting protocol of &lt;code&gt;DelayQueue&lt;/code&gt;.&lt;/p&gt;</description></item></channel></rss>