Uploaded image for project: 'Spring Integration'
  1. Spring Integration
  2. INT-1141

Avoid Handler List cloning when delivering messages.

    XMLWordPrintable

    Details

      Description

      While delivering messages, the AbstractDispatcher generates 2 copies of the registered handlers collection in order to iterate them. We have found a 30% increment throughput after replacing the structure used for storing handlers. This new structure allows iteration, and concurrent modification (if any) of the collection, and avoids the need of copying it everytime a message needs to be dispatched by a MessageChannel.

      I am attaching the OrderedAwareCopyOnWriterArrayList and the AbstractDisptacher which uses it.

      This implementation improves the most common usage of the registered handlers collection (iteration), and as drawback, handler registration takes O(n). We tried to keep compatibility with the previous implementation, therefore we need to add a handler to the list iif it is not already in it. If this is not a requirement and it was actually a side effect of using a set as base structure, we can just add the new handler and reduce the Order from n to ~1.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              oleg.zhurakousky@springsource.com Oleg Zhurakousky
              Reporter:
              dbelfer Diego Belfer
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 0.5d
                  0.5d
                  Remaining:
                  Remaining Estimate - 0.5d
                  0.5d
                  Logged:
                  Time Spent - Not Specified
                  Not Specified