[concurrency-interest] Changing delays in DelayQueue ?
Hanson Char
hanson.char at gmail.com
Thu Sep 7 12:20:31 EDT 2006
Javadoc of j.u.c.DelayQueue:
"The *head* of the queue is that Delayed element whose delay expired
furthest in the past."
I've been wondering, after the elements have been enqueued, if the above
"invariant" could still be maintained even if the delays of the elements are
modified (such that the order of the delays become different from those as
at the time when the elements were inserted.)
Example,
1) enqueue elements [a, b], whereas a.delay < b.delay
2) modify a and b such that b.delay < a.delay
3) dequeue elements
It would be nice if (3) could result in the order of [b,a], instead of
[a,b], which is the existing behavior of DelayQueue.
Is there an easy way to achieve the desired behavior without compromising
concurrency ?
Hanson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20060907/5d657daf/attachment.html
More information about the Concurrency-interest
mailing list