Github user JoshRosen commented on the pull request:
https://github.com/apache/spark/pull/6479#issuecomment-108750436
@davies, regarding the global lock, I think that we need it strictly
because of `ClassBodyEvaluator`'s lack of thread-safety, not to prevent
duplicate loading for expressions.
According to Guava's [CacheBuilder
documentation](http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/cache/CacheBuilder.html#build(com.google.common.cache.CacheLoader))
for `CacheBuilder.build(loader)`:
> Builds a cache, which either returns an already-loaded value for a given
key or atomically computes or retrieves it using the supplied CacheLoader. If
another thread is currently loading the value for this key, simply waits for
that thread to finish and returns its loaded value. Note that multiple threads
can concurrently load values for distinct keys.
Spark's HistoryServer makes use of this and I've used this pattern in some
other code as well. Not a correctness / performance issue for this PR, but
just wanted to point this out since it's a neat thread-safety trick that Guava
gives us.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]