Github user vanzin commented on the issue: https://github.com/apache/spark/pull/17610 > An AtomicBoolean will introduce a new lock I don't think it introduces a new lock, just an easy way to make `stop()` idempotent. I guess the question to ask is (and is basically what you already asked): does `stop()` need to hold any locks? That `synchronized` has been there since the class was added, so it's hard to measure the original intent, but a quick look at the code seems to show that a lock is not necessary, and a boolean to check whether stop has already been called should be enough. The new lock being added here only prevents two thread from concurrently executing `stop()`. I think that's not something that usually happens, and if it ever does, having one of them return immediately (instead of blocking) shouldn't cause any problems. But, at the end, either solution should be fine, as long as `stop()` behaves correctly when it's not holding the "this" lock.
--- 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