kezhenxu94 opened a new pull request #3106: Use CopyOnWriteArrayList instead of recreating manually URL: https://github.com/apache/skywalking/pull/3106 Please answer these questions before submitting pull request - Why submit this pull request? - [ ] Bug fix - [ ] New feature provided - [x] Improve performance https://github.com/apache/skywalking/blob/8faa3564037570fca198ab9f70534f3d359a9d40/apm-commons/apm-datacarrier/src/main/java/org/apache/skywalking/apm/commons/datacarrier/consumer/MultipleChannelsConsumer.java#L99-L109 the comment `// Recreate the new list to avoid change list while the list is used in consuming.` reminds me of the `CopyOnWrite` data structure that is perfectly suitable to this scenario, although the method `addNewTarget` is not frequently invoked, I did a simple benchmark out of curiosity. This patch also fixes that the non-atomic operation `+=` on the `volatile` variable `size`
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
