Currently, we lock each individual loader object with its own lock. This can result in deadlocks, when loaders call into other loaders in the process of loading.
Instead, we want to try a single, central, high-level lock, perhaps in the base load function, that is tied to the environment/loaders object. So only one thing can be loaded for a given environment at a time. This should avoid deadlocks.
We'll probably want to try profiling this a little, but it should avoid the issue that is currently making multithreaded with environment caching unusable. See SERVER-2860 and PE-30479.
This solution is an alternative to