You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by Chris Burnley <ch...@gmail.com> on 2005/09/29 11:14:32 UTC

ServicePointImpl.getService caching service reference

Hi, I'd like to query why ServicePointImpl.getService method caches the
service object.

I'm implementing a "template" service model which always creates new
instances ( perhaps I'm going about it the wrong way), which of course
doesn't work because the the service is cached in ServicePointImpl. I
realise that in theory services should be usually mostly stateless and
interchangeable, but that is contradicted by the existence of the thread
service model.

Shouldn't the reference returned be the responsibility of ServiceModel ?

regards,

Chris Burnley

Re: ServicePointImpl.getService caching service reference

Posted by Chris Burnley <ch...@gmail.com>.
No, its not what I need. Basically, I have a definition of a service that
needs to be distinct instances of a service that potentially could have some
additional configuration applied to it ( like setting its name or
something).(these are supplied by a contribution).

I am wondering if a service projection or something might be the thing I
need, but I've not explored that aspect of hivemind yet.

I.e. create a new service based on an existing service but with some
additional config.

On 9/29/05, Knut Wannheden <kn...@gmail.com> wrote:
>
> Chris,
>
> The service implementation returned by the ServicePoint object is
> indeed cached. But it's up to the ServiceModel object to supply it.
> And often (for all models but "primitive") this won't be the actual
> core service implementation (CSI) but rather a proxy object, which
> will lazily create the CSI and delegate to it.
>
> That being said I don't think you can implement "template" (usually
> refered to as "prototype" in Spring) as you see it as a service model.
> What you could quite easily do is implement a service model which
> returns a new CSI for every method invocation on the service. But
> that's not what you want, is it?
>
> Take a look at the HiveMind BeanFactory:
> http://jakarta.apache.org/hivemind/hivemind-lib/BeanFactoryBuilder.html.
> If you need more advanced dependency injection on the created objects
> you will have to roll your own. Take a look at this message for some
> ideas: http://tinyurl.com/9m4kn.
>
> We're looking into implementing reusable code more advanced dependency
> injection, a la BuilderFactory, in HiveMind 1.2.
>
> HTH,
>
> --knut
>
> On 9/29/05, Chris Burnley <ch...@gmail.com> wrote:
> > Hi, I'd like to query why ServicePointImpl.getService method caches the
> > service object.
> >
> > I'm implementing a "template" service model which always creates new
> > instances ( perhaps I'm going about it the wrong way), which of course
> > doesn't work because the the service is cached in ServicePointImpl. I
> > realise that in theory services should be usually mostly stateless and
> > interchangeable, but that is contradicted by the existence of the thread
> > service model.
> >
> > Shouldn't the reference returned be the responsibility of ServiceModel ?
> >
> > regards,
> >
> > Chris Burnley
> >
>

Re: ServicePointImpl.getService caching service reference

Posted by Knut Wannheden <kn...@gmail.com>.
Chris,

The service implementation returned by the ServicePoint object is
indeed cached. But it's up to the ServiceModel object to supply it.
And often (for all models but "primitive") this won't be the actual
core service implementation (CSI) but rather a proxy object, which
will lazily create the CSI and delegate to it.

That being said I don't think you can implement "template" (usually
refered to as "prototype" in Spring) as you see it as a service model.
What you could quite easily do is implement a service model which
returns a new CSI for every method invocation on the service. But
that's not what you want, is it?

Take a look at the HiveMind BeanFactory:
http://jakarta.apache.org/hivemind/hivemind-lib/BeanFactoryBuilder.html.
If you need more advanced dependency injection on the created objects
you will have to roll your own. Take a look at this message for some
ideas: http://tinyurl.com/9m4kn.

We're looking into implementing reusable code more advanced dependency
injection, a la BuilderFactory, in HiveMind 1.2.

HTH,

--knut

On 9/29/05, Chris Burnley <ch...@gmail.com> wrote:
> Hi, I'd like to query why ServicePointImpl.getService method caches the
> service object.
>
>  I'm implementing a "template" service model which always creates new
> instances ( perhaps I'm going about it the wrong way), which of course
> doesn't work because the the service is cached in ServicePointImpl. I
> realise that in theory services should be usually mostly stateless and
> interchangeable, but that is contradicted by the existence of the thread
> service model.
>
>  Shouldn't the reference returned be the responsibility of ServiceModel ?
>
>  regards,
>
>  Chris Burnley
>

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