|
Re: PriorityBlockingQueue question: msg#00002java.jsr.166-concurrency
On Sep 26, 2006, at 11:11 AM, Tim Peierls wrote: > On 9/26/06, Tim Peierls <tim@xxxxxxxxxxx> wrote: > No ideas for this -- I'm thinking about the other approach. > > What if you maintained a separate queue for each selector and > atomically marked messages when consumed? (You could use > AtomicMarkableReference.attemptMark, for example.) Then you don't > have the problem of having to remove a message from all other > queues, since receivers can simply ignore messages that someone > else marked. Thanks for the suggestion, Tim. See https://somnifugijms.dev.java.net/source/browse/somnifugijms/v3/ source/somnifugi/net/walend/somnifugi/juc/ MessageSelectingPriorityBlockingQueue.java?rev=1.3&view=auto&content- type=text/vnd.viewcvs-markup for a new version. I like this one a lot. JMS QueueSenders handle the message selector workings inside offer(). JMS QueueReceivers with no message selector (and will use the ALLMESSAGESELECTOR) will have something close to PBQ performance. QueueReceivers with messages selectors will still have to do a PBQ scan in the remove() method, but that's the only disappointing thing. Everything else should be very live. Thanks again for the help. Please let me know if you see any problems when you flip through the code. Dave David Walend david@xxxxxxxxxx
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: How to use Callable instead of Runnable with ScheduledThreadPoolExecutor?, Tim Peierls |
|---|---|
| Next by Date: | Re: PriorityBlockingQueue question, Tim Peierls |
| Previous by Thread: | How to use Callable instead of Runnable with ScheduledThreadPoolExecutor?, Robert Bowen |
| Next by Thread: | Re: PriorityBlockingQueue question, Tim Peierls |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |