You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by Davor Hrg <hr...@gmail.com> on 2006/10/24 21:43:21 UTC

Re: Service that creates new instance on each request?

you could maybe add your own object provider,
I had'nt checked it deeply, but I think your
method will be called each time object is injected,
and then you can return new instance every time.




On 10/20/06, Aj Gregory <aj...@u.washington.edu> wrote:
>
> I'm looking for a method so each proxy delegates to it's own instance
> which is unique to that proxy....
>
> Ultimately what I'm trying to do is create a service-point which vends
> out a proxy to an instance so I can create an interceptor on the proxy
> to implement some of the methods from the interface and pass other
> method calls to the instance wrapped in the proxy...
>
> Has anybody done something similar?
>
> -Aj
>
> James Carman wrote:
> > You can use the "threaded" model.  That would give you a unique
> > instance for each thread (or web request if you're writing a webapp).
> > HiveMind doesn't really inject the implementation object into other
> > objects.  It injects a proxy.  The proxy will make sure it delegates
> > to the appropriate implementation object based on the service
> > lifecycle model.
> >
> > On 10/20/06, *Aj Gregory* <ajgnet@u.washington.edu
> > <ma...@u.washington.edu>> wrote:
> >
> >     Is there some way to create a service-point so it will create a new
> >     instance of an implementation class each time the service is
> injected
> >     somewhere?  Kinda the exact opposite of singleton.
> >
> >     Thanks,
> >     -Aj
> >
> >
>