[concurrency-interest] Bounded PriorityBlockingQueue

Dr Heinz M. Kabutz heinz at javaspecialists.eu
Wed Jun 26 14:48:18 EDT 2013


Hi Gustav,

Would it not be a lot easier to wrap a PriorityBoundedQueue with
another class that simply uses a Semaphore to limit the total number
of elements inside the queue?  Goetz's book has an implementation for
a BoundedQueue.

Heinz

On 26/06/2013, Gustav Åkesson <gustav.r.akesson at gmail.com> wrote:
> Hi,
>
> I had a use case for a bounded priority blocking queue in a large-scale
> server but couldn't find any useful implementation. Below is my
> implementation:
>
> https://github.com/gakesson/ConcurrencyUtils/blob/c5794c5b7c0ada763549cadfbbbd345713ace79a/BoundedPriorityBlockingQueue.java
>
> Feel free to have a look at it, test it and come up with feedback and
> improvements. Also, if you have had the same requirements as I, feel free
> to use it but don't forget to contribute if/when you find improvements. :-)
>
>
> Best Regards,
>
> Gustav Åkesson
> Cogitel AB
> Sweden
>


-- 
Dr Heinz M. Kabutz (PhD CompSci)
Author of "The Java(tm) Specialists' Newsletter"
Sun/Oracle Java Champion 2005-2013
JavaOne Rockstar Speaker 2012
http://www.javaspecialists.eu
Tel: +30 69 75 595 262
Skype: kabutz



More information about the Concurrency-interest mailing list