9 Replies Latest reply on Sep 21, 2012 2:27 PM by kzakhar

    Thread-safe routing calculation. BindingsImpl.getNextBinding implementation

    kzakhar

      Hi, folks!

       

      I would like to clarify a bit the internals of the HornetQ routing mechanism. In case of the messages are simultaneously being sent to the same destination via the different sessions, then the org.hornetq.core.postoffice.impl.BindingsImpl can be accessed by multiple threads.

       

      When I look into the source code, I see a race condition for

      private final Map<SimpleString, Integer> routingNamePositions = new ConcurrentHashMap<SimpleString, Integer>();
      

      in the getNextBinding method.

       

      The changes in the "routing positions" means that some messages can be delivered to the wrong subscription, i.e. either not delivered at all or delivered to not all matched subscriptions.

       

      Can someone (the HornetQ dev. team I guess) explain me the reason behind the BindingsImpl implemented like it is done now? Do I miss something?

       

      Can this be the root-cause for the similar issues on the forums, e.g.: https://community.jboss.org/thread/205384?tstart=0

       

      Best regards,

      Konstantin