Github user vanzin commented on the pull request: https://github.com/apache/spark/pull/6457#issuecomment-141535317 Hi @zsxwing, There were a couple of things that were bothering me in the code but I couldn't really put my finger on them. Instead of trying to point them out in comments, I played a little with your code and made changes to it. - thread-safety: https://github.com/vanzin/spark/commit/ea62714d32c764957c8bb6fa13fbd46b312f9538 This follows up on my "using AtomicInteger" comments. The synchronization-based code had at least a couple of races in it; my changes avoid using synchronization in `Inbox` and fix those races too. - too many maps: https://github.com/vanzin/spark/commit/e6674673518ef95cc20c5f0d0f113ce6711b7917 I think this looks a little bit cleaner and is easier to follow than the previous code. There are some changes here, particular to the tests, that should actually be part of the previous commit. Could you take a look at those and see what you think? There's some synchronization code in `Dispatcher` also that I didn't try to remove; it didn't seem necessary to do that at this point, since that would be mostly for performance reasons.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org