In com.google.inject.servlet.GuiceServletContextListener the Injector is 
set as a servlet context attribute.

So I wonder whether we can have static Injector then.

Since we are using jersey(for REST) in some part of our projects and use 
guice as the DI.
We wanted to share the same injector reference across both these 
components, by making it static.



On Wednesday, March 14, 2007 at 5:37:30 AM UTC+2, crazy...@gmail.com wrote:
>
> On 3/13/07, Robin Sheat <eyt...@gmail.com <javascript:>> wrote:
>
>> Hi there, are the calls to things like injector.getInstance thread-
>> safe? As I gradually move my program to using Guice throughout, the
>> unported classes still have a lot of Factory.getSomething() calls
>> which I'll be implementing with calls to getInstance. Should I 
>> implement synchronisation on them, or is it handled internally? (i.e.
>> if one request causes a singleton to be created, and another request
>> comes in while that instance is being created, will that be a
>> problem?) 
>
>
> Injector is thread safe, and very concurrent. Don't worry about 
> synchronizing.
>
> Bob
>
>

-- 
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 google-guice+unsubscr...@googlegroups.com.
To post to this group, send email to google-guice@googlegroups.com.
Visit this group at http://groups.google.com/group/google-guice.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-guice/1d00f451-e6f2-4501-81f9-454e3f1f1780%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to