[concurrency-interest] BoundedPriorityBlockingQueue ?

rbalamohan rbalamohan at sonoasystems.com
Tue Sep 12 23:20:40 EDT 2006


Hi Hanson,

In simplistic terms, It has to follow the same semantics of BQ. David's
question is valid as well which can be rectified in a way. I am just
proposing one such thought. It might have some caveats. Please feel free
to suggest a better solution.

1. BPQ will have multiple PQs with specific priorities. (public
BoundedPriorityBlockingQueue(int priorityCount, int capacity) {})
2. However from external user point of view, it should seen as a single
queue.
3. When a job is submitted with a priority, it should get enqueued in
the appropriate PQ of the BPQ. (May be we can use some BitSet for
checking if the queues of BPQ is empty or not)
4. When a get() is called, it should always return an element from the
top priority queue in BPQ.
5. If all the PQs are empty in BPQ, we need to block block.

~Rajesh.B

On Tue, 2006-09-12 at 19:18 -0700, Hanson Char wrote:

> you use a blocking put() t
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20060913/d4b4009a/attachment-0001.html 


More information about the Concurrency-interest mailing list