[concurrency-interest] LBQ vs CLBQ

Szabolcs Ferenczi szabolcs.ferenczi at gmail.com
Wed Apr 4 18:11:10 EDT 2007

On 04/04/07, Hanson Char <hanson.char at gmail.com> wrote:
> The put method in CLBQ, being unbounded, will always succeed "immediately"
> without waiting.  But waiting with zero time doesn't mean it does not
> satisfy the contract of the BlockingQueue put method, as the happen-before
> relationship is still satisfied by the current implementation.
> Or am I missing something here ?

Hi Hanson,

I think you miss that the semantics of put in the interface
BlockingQueue says that it waits if necessary for space to become
available. It is not the same as method add which does not wait but
returns a boolean.

On the other hand, you claim that your CLBQ can replace LBQ. Now LBQ
is bounded. By default, the capacity is Integer.MAX_VALUE. This means
that on an LBQ the put waits when the queue has already
Integer.MAX_VALUE number of elements. It is not the same for your CLBQ
if you forward the put to an instance of a ConcurrentLinkedQueue as an
add call. Do you agree?

Best Regards,

More information about the Concurrency-interest mailing list