activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Burton <>
Subject Does MessageStore.getMessage need to be fast?
Date Mon, 06 Apr 2015 21:05:44 GMT
So I’m torn between two implementations of a new MemoryStore using JMS

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


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.


Location: *San Francisco, CA*
… or check out my Google+ profile

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message