[concurrency-interest] LBQ vs CLBQ

Hanson Char hanson.char at gmail.com
Wed Apr 4 17:44:45 EDT 2007


Hi Szabolcs,

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 ?

Hanson Char

On 4/4/07, Szabolcs Ferenczi <szabolcs.ferenczi at gmail.com> wrote:
>
> On 04/04/07, Hanson Char <hanson.char at gmail.com> wrote:
>
> > > the put method is not implemented with the semantics as defined in the
> > > BlockingQueue interface.
> >
> > Why not ?  Can you please elaborate ?
>
> The description of the put for the BlockingQueue interface says:
> "Inserts the specified element into this queue, waiting if necessary
> for space to become available." In the CLBQ implementation, however,
> the put is implemented by a forwarded call to the add method of the
> ConcurrentLinkedQueue member. The add is a non-blocking method, it
> "Inserts the specified element at the tail of this queue." and returns
> a boolean. Thus, no waiting is there behind the add method which is
> required for the put method whenever the queue is at the limit of its
> capacity. Does this help?
>
> Best Regards,
> Szabolcs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20070404/e77770b8/attachment.html 


More information about the Concurrency-interest mailing list