"threaded" means that you will get a singleton *per-thread*, that is, the service will return the same instance whenever you call getService() from the same thread. The instance will be discarded when that thread calls fireThreadCleanup() on the ThreadNotifier service.
See http://jakarta.apache.org/hivemind/services.html#Threaded+Service+Model I don't think there is a model which provides a new instance every time. Tom On Tue, 23 Nov 2004 22:25:52 +0100, Stephane Louet <[EMAIL PROTECTED]> wrote: > 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
