# Identifying Blocked Producers in Java BlockingQueue with Profiling and JDK Flight Recorder

DevFeed: [Identifying Blocked Producers in Java BlockingQueue with Profiling and JDK Flight Recorder](<https://devfeed.tech/articles/is-your-blocking-queue-blocking-18839.md>)

Original publisher: [Read original article](<https://www.morling.dev/blog/is-your-blocking-queue-blocking/>)

Published: 2023-01-03T21:10:00Z

Content type: tutorial

Language: en

Sources: [Gunnar Morling](<https://devfeed.tech/sources/gunnar-morling.md>)

Topics: [Java](<https://devfeed.tech/topics/java.md>), [JDK Flight Recorder](<https://devfeed.tech/topics/jdk-flight-recorder.md>), [Concurrency](<https://devfeed.tech/topics/concurrency.md>)

Tags: [blocking](<https://devfeed.tech/tags/blocking.md>), [java](<https://devfeed.tech/tags/java.md>), [jdk-flight-recorder](<https://devfeed.tech/tags/jdk-flight-recorder.md>), [performance](<https://devfeed.tech/tags/performance.md>), [threads](<https://devfeed.tech/tags/threads.md>)

## AI overview

This tutorial explains how to detect producer threads blocked while adding work to a bounded Java BlockingQueue. It discusses wall-clock profiling with async-profiler and using custom JDK Flight Recorder events when profiling is unavailable.

## Source excerpt

Table of Contents Emitting Custom Events Filtering "Thread Park" Events Towards Real-Time Analysis of JFR Events Java's BlockingQueue hierarchy is widely used for coordinating work between different producer and consumer threads. When set up with a maximum capacity (i.e. a bounded queue), no more elements can be added by producers to the queue once it is full, until a consumer has taken at least one element. For scenarios where new work may arrive more quickly than it can be consumed, this applies means of back-pressure, ensuring the application doesn't run out of memory eventually, while enqueuing more and more work items.