groostav
05/05/2017, 12:43 AMSingletonScope
implementation to use suspension instead of locks (or better yet, make the locking scheme parametric). https://github.com/google/guice/blob/master/core/src/com/google/inject/internal/SingletonScope.java
note the description for the faint of heart:
Introduction from the author: Implementation of this class seems unreasonably complicated at the first sight. I fully agree with you, that the beast below is very complex and it's hard to reason on how does it work or not. Still I want to assure you that hundreds(?) of hours were thrown into making this code simple, while still maintaining Singleton contract.I'd like to have a crack at it.