mattrpav opened a new pull request, #2796: URL: https://github.com/apache/activemq/pull/2796
Usage.children was a CopyOnWriteArrayList, so addChild and removeChild copied the whole array on every call. A broker that creates or destroys many destinations wires one MemoryUsage child per destination into the parent SystemUsage, which made child registration O(n) per call and O(n squared) over a create or destroy storm, with one array copy each time. Back children with a ConcurrentHashMap keyset instead. Add and remove are constant time and readers stay lock free. The children are distinct instances that are only iterated, never indexed or kept in order, so set semantics match the previous use. getChildren returns a snapshot list so its signature is unchanged. The listeners field keeps copy-on-write for its read heavy notification path. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information, visit: https://activemq.apache.org/contact
