> private static Injector injector; or better:
private static volatile Injector injector; see http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html On Tue, Mar 25, 2014 at 9:55 PM, Patricio Echagüe <[email protected]>wrote: > It's fine. You can synchronize with a static monitor the creation on the > injector per worker. That's how I do it. > > public class InjectorProvider { > > private static Injector injector; > > public static Injector get() { > if (injector == null) { > synchronized (InjectorProvider.class) { > if (injector == null) { > injector = Guice.createInjector( > new DAOModule(), > new S3Module(); > } > } > } > > return injector; > } > > > On Tue, Mar 25, 2014 at 6:24 PM, Adam Lewis <[email protected]> wrote: > >> >> Doesn't Storm 0.9 have a prepare for the worker? >>> >> >> No, I don't think it does, but please point this out if I'm mistaken. I >> found the right JIRA issue though: >> https://issues.apache.org/jira/browse/STORM-126 >> >> Seems like the patch was well along but hasn't seen any recent activity. >> > >
