Updates:
        Status: WorkingAsIntended

Comment #13 on issue 183 by [email protected]: Scopes.SINGLETON uses a global lock
http://code.google.com/p/google-guice/issues/detail?id=183

It's not safe to synchronize on an individual singleton. If two threads access the injector and trigger initialization of the same singleton, you could end up with two instances of the singleton or worse, a deadlock.

The moral of this story is during injection, don't spawn and wait for a thread that accesses the injector. This is equivalent to spawning a thread from a static initializer; you shouldn't do that either.

Craig, ideally you'd avoid calling user code from a synchronization block, but that's not always possible. For example, ConcurrentHashMap calls equals() and hashCode() while holding a lock.

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice-dev?hl=en.

Reply via email to