activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Burton <>
Subject Why is MemoryMessageStore a map and not a queue… Re-implementing with a PriorityBlockingQueue
Date Wed, 01 Apr 2015 19:57:41 GMT
I’m curious why MemoryMessageStore is backed by a LinkedHashMap and not a
queue data structure.

Does anyone know?  It might be just do to the age.

The one thing that could break it is:

    public void updateMessage(Message message)

.. which updates the message by ID.  But make we could keep two indexes, a
queue and a concurrent map.  but I think updateMessage is only called for
persistent messages.

I’m asking because I’m investigating implementing JMS priority in the
memory store.  If it was backed by a priority queue (lower case, not
necessarily proposing the PriorityQueue but more of
java.util.concurrent.PriorityBlockingQueue or maybe even something from

It would be trivial to implement JMS priority at that point I think.
Messages would just be returned based on their JMS priority then FIFO order.

Also, this class uses a lot of synchronization which would be removed if it
was refactored this way.

I’m still experimenting with this idea.  I still have to fix the 5.11.x
regressions we’ve found.




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

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