[concurrency-interest] Proposal WeightedLinkedBoundedQueue

Dawid Kurzyniec dawidk at mathcs.emory.edu
Thu Nov 30 17:40:30 EST 2006

Thierry Hanot wrote:
> That was the answer I was waiting for :)
> I'm doing it now ;)

> Thierry Hanot wrote:
>> But I'm still believe
>> that we can avoid any synchronization over cost by simply modifying the LinkedBoundedQueue and changing the AtomicInteger used to manage the
>> count :).
> Nothing can stop you from grabbing a public-domain source from:
> http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/main/java/util/c
> oncurrent/
> and custom-fitting it for your purpose. Which is one of many reasons why
> we love this library so much :)

Just one more thing - I am not sure if this is going to be a problem in
your case, but are you aware of potential starvation scenarios? E.g. if
your queue is full most of the time, and if you have a requestor that
wants to put a really large object in the queue, it might never get a
chance to do so (losing competition with other requestors putting
smaller objects, so that there is never enough space available for the
big guy). In the semaphore-based approach, you could prevent this by
using a fair semaphore. If you're doing it by hand, you might want to be
careful about this.


More information about the Concurrency-interest mailing list