I like it Tim

Romain

Le jeudi 17 octobre 2013 11:50:43 UTC+2, Tim Boudreau a écrit :
>
> I read the bug report and the longer discussion.  That singletons are 
> classloader-wide does seem wrong (reminds me of the many woes caused by the 
> AWT tree lock).
>
> Seems like the bug is the fact that Scopes.SINGLETON is a static field 
> (not a small amount of irony to that in Guice :-)).  I mean, effectively, 
> there's no difference between synchronized(Injector.class) and 
> synchronized("foo") - either is a handy public field that was lying around 
> and able to be a monitor;  using Injector.class is just slightly less 
> obviously evil.
>
> Otherwise you could have a "singleton with respect to this injector and 
> its parents" (or just this injector) scope that was private to the injector 
> and expose it via an instance method on, say, AbstractModule (still need a 
> way to expose it to those who implement Module directly, though) - which 
> would function identically to the situation now, except that two unrelated 
> injectors could not interfere with each other. 
>  bind(Foo.class).in(singletonScope());  There just needs to be a way to 
> give child injectors a reference to the parent injector's lock.
>
> -Tim
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to