[concurrency-interest] PriorityBlockingQueue question

David Walend david at walend.net
Wed Oct 4 09:13:02 EDT 2006

On Sep 26, 2006, at 11:11 AM, Tim Peierls wrote:

> On 9/26/06, Tim Peierls <tim at peierls.net> 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/ 
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.


David Walend
david at walend.net

More information about the Concurrency-interest mailing list