activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Bish <>
Subject Re: Does MessageStore.getMessage need to be fast?
Date Mon, 06 Apr 2015 21:38:06 GMT
On 04/06/2015 05:05 PM, Kevin Burton wrote:
> So I’m torn between two implementations of a new MemoryStore using JMS
> priority.
> I could do it the FAST way, and use just a regular queue object, which
> would include support for priorities, BUT would be slower for certain
> operations like remove, get, and maybe size.
> It would just use a PriorityBlockingQueue
> OR
> I could do it the SLOW (and somewhat ugly) way but make it more compatible
> with what works now. Basically I would use a ReentrantReadWriteLock around
> both a map and a queue.  The queue would be used or (obvious) queue
> operations but the map would be used for getMessage and remove() … It would
> also work with topics.
> The FAST way above wouldn’t work well with getMessage… because I would have
> to iterate over the whole queue and then compare each message.
> I guess maybe the best way to go is to be conservative/pragmatic here and
> move to a ReentrantReadWrite lock model and use both a map and a queue.
> This would prevent any weird behavior that I don’t anticipate in exchange
> for speed.  It would also mean it would work well for topics too.
I'd go with the second option as you still want to management operations
to perform in a reasonable fashion even with the memory store.

Tim Bish
Sr Software Engineer | RedHat Inc. | 
twitter: @tabish121

View raw message