[concurrency-interest] Is there a ConcurrentBlockingQueue ??

Rajesh Balamohan rajesh.balamohan at gmail.com
Mon Mar 19 22:55:10 EDT 2007

Hi All,

We are using LinkedBlockingQueue since it blocks on take() method. We have a
requirement like the following.

1. Many tasks are submitted to a threadpool by different threads. The task
internally adds some item to a LinkedBlockingQueue. I have striped down most
of the logic below. Please ignore the contents as such.

//The following task will be submitted by a pool of threads to a
 static class Request implements Runnable {

        MessageState state = new MessageState();

        public void run() {
            synchronized (state) {
                if (!state.isRequestStarted()) {

2. One reaper thread is created whose job is to keep on taking out the items
from the LinkedBlockingQueue (basically like the following)

while(true) {

private void accept() {
  try {
     MyItem item = myLinkedBlockingQueue.take();
 } ...blah blah...
do necessary processing.

Now, I feel that it should be ConcurrentLinkedQueue instead of
LinkedBlockingQueue. ConcurrentLinkedQueue might be able to scale well than
LinkedBlockingQueue for multiple threads.

Problem is ConcurrentLinkedQueue doesn't have a blocking take(). Are there
any plans to add it? Or you think that this problem can be solved

-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20070320/b595d0d3/attachment.html 

More information about the Concurrency-interest mailing list