hivemind-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Howard Lewis Ship <hls...@gmail.com>
Subject Re: Service instanciation
Date Tue, 23 Nov 2004 22:45:47 GMT
That would be a new service model; Spring has a similar concept and
calls it "prototype".


On Tue, 23 Nov 2004 16:37:52 -0500, Hensley, Richard
<richard.hensley@mckesson.com> wrote:
> Stefano,
> 
> Threaded means that you get a new instance for each thread, not each time
> you call getService(). I'm not sure how to configure HiveMind to do what you
> want.
> 
> Richard 
> 
> 
> 
> -----Original Message-----
> From: Stephane Louet [mailto:slouet@hotmail.com]
> Sent: Tuesday, November 23, 2004 1:26 PM
> To: hivemind-user@jakarta.apache.org
> Subject: Service instanciation
> 
> I have a newbie question for you guys. I have declared a service point that
> looks like below:
> 
> <service-point id="AttrDef" interface="mypackage.attr.AttrDef">
>         <invoke-factory model="threaded">
>           <construct class="mypackage.attr.impl.AttrDefImpl"/>
>         </invoke-factory>
>         <interceptor service-id="hivemind.LoggingInterceptor"/>
> </service-point>
> 
> I have used "threaded" because I want a new instance of AttrDefImpl every
> time I do a .getService( AttrDef.class ). But if I do something like:
> 
> AttrDef attrDef1 = (AttrDef)registry.getService( AttrDef.class );
> attrDef1.setName( "1" );
> 
> AttrDef attrDef2 = (AttrDef)registry.getService( AttrDef.class );
> attrDef2.setName( "2" );
> 
> System.out.println( "attrDef1=" + attrDef1.getName() + ", attrDef2=" +
> attrDef2.getName() );
> 
> I basically get the following attrDef1=2, attrDef2=2. It looks like
> .getService() returns the same element (a singleton?) every time. I believe
> I am missing something here ;-)
> 
> Any help appreciated,
> Stefano
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


Mime
View raw message