Thanks. I think that cleared up most of my misunderstanding.

On Thu, Mar 27, 2014 at 6:16 AM, Adam Lewis <[email protected]> wrote:
> Yes that is exactly right, the submission to Nimbus is in the form of a big
> thrift message describing the topology...this message includes java
> serialized blobs of your topology components (spouts/bolts). They get
> instantiated within the VM calling StormSubmitter.  Typically you would pass
> configuration info to the constructor, but "dependencies" (e.g. DB
> connection pool, etc) are transient fields.  Then in the prepare method
> (called after deserialization on the worker) you use the serialized
> configuration fields to initialize the transient ones.  Of course Guice fits
> naturally into that step.
>
>
> On Thu, Mar 27, 2014 at 12:37 AM, Software Dev <[email protected]>
> wrote:
>>
>> Ok so you would configure the map in the main method before submitting
>> the topology. Then this conf can be used to create guice injectors. Is
>> that correct?
>>
>> In the book "Getting Started with Storm" it states:
>>
>> "To customize a bolt, you should set parameters in its constructor and
>> save them as instance variables so they will be serialized when
>> submitting the bolt to the cluster."
>>
>> Does this mean bolts are instantiated on the client side before being
>> submitted to nimbus/cluster?
>>
>> On Wed, Mar 26, 2014 at 2:05 PM, Svend Vanderveken
>> <[email protected]> wrote:
>> >
>> > The storm configuration map is part of the arguments received by each
>> > prepare() method, in most Storm primitives, on each worker. It's
>> > serialised
>> > to each worker when a topology instance is started there. The initial
>> > storm
>> > configuration map is provided at deploy time to Nimbus, in the class
>> > containing the main() method, specified in the "storm jar blabla.jar
>> > some.class.here" command.
>> >
>> >
>> >
>> >
>> > On Wed, Mar 26, 2014 at 4:42 PM, Software Dev
>> > <[email protected]>
>> > wrote:
>> >>
>> >> How does one get the configuration map to each worker?
>> >>
>> >> On Wed, Mar 26, 2014 at 6:41 AM, Adam Lewis <[email protected]> wrote:
>> >> > Or, since this is only being called from prepare at startup anyway,
>> >> > simpler:
>> >> >
>> >> > public class InjectorProvider {
>> >> >
>> >> > private static Injector injector;
>> >> > public static synchronized Injector get(Map conf) {
>> >> > if (injector == null) {
>> >> > injector = Guice.createInjector(
>> >> > new DAOModule(conf),
>> >> > new S3Module(conf));
>> >> > }
>> >> >
>> >> > return injector;
>> >> > }
>> >> > }
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > On Wed, Mar 26, 2014 at 9:26 AM, Svend Vanderveken
>> >> > <[email protected]> wrote:
>> >> >>
>> >> >> > 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.
>> >> >>>
>> >> >>>
>> >> >>
>> >> >
>> >
>> >
>
>

Reply via email to