You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by Knut Wannheden <kn...@gmail.com> on 2004/11/11 09:37:54 UTC

Re: Registry.getService VS ServiceManager.lookup

Igor,

If you're not using HiveMind's threaded or pooled service models for
your service you should always get back the same instance.  Provided
that you invoke getService(Class) on the same Registry object, of
course :-)

With the threaded and pooled service models you might get a different
instance depending on what thread is making the call.

Hope this helps,

--knut

On Thu, 11 Nov 2004 11:55:05 +0300, Igor A. Deruga <in...@hotbox.ru> wrote:
> Good *, dear fellow programmers!
> 
> As far as I know, avalon's ServiceManager.lookup method returns an instance of
> some class. When I invoke it for the second time, it returns me the SAME
> instance. How do I get this result with Registry class implemented in
> HiveMind? Registry.getService(Class cls) returns me the knew instance every
> time. I can write a wrapper with Map, but I think there should be a way...
> Maybe, I'm wrong in some point?
> 
> Sincerely
>         Igor
> 
> ---------------------------------------------------------------------
> 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


Re: Registry.getService VS ServiceManager.lookup

Posted by "Igor A. Deruga" <in...@hotbox.ru>.
Thanks, people!
That explains almost everything!

Sincerely
	Igor.

On Thursday 11 November 2004 17:04, Howard Lewis Ship wrote:
> Actually, you will *always* get the same instance back with HiveMind
> ... what you get back is a proxy.  If your service uses the threaded
> or pooled lifecycle, then the implementation (hidden behind the proxy)
> may vary.
>
> Much of the fun code inside HiveMind is to allow for this; that the
> same proxy can propogate around the service implementations, or be
> exposed to the client application via Registry.getService() and it
> will always Just Work, even accounting for things like interceptors,
> just-in-time service creations, and various service models.
>
>
> On Thu, 11 Nov 2004 09:37:54 +0100, Knut Wannheden
>
> <kn...@gmail.com> wrote:
> > Igor,
> >
> > If you're not using HiveMind's threaded or pooled service models for
> > your service you should always get back the same instance.  Provided
> > that you invoke getService(Class) on the same Registry object, of
> > course :-)
> >
> > With the threaded and pooled service models you might get a different
> > instance depending on what thread is making the call.
> >
> > Hope this helps,
> >
> > --knut

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


Re: Registry.getService VS ServiceManager.lookup

Posted by Howard Lewis Ship <hl...@gmail.com>.
Actually, you will *always* get the same instance back with HiveMind
... what you get back is a proxy.  If your service uses the threaded
or pooled lifecycle, then the implementation (hidden behind the proxy)
may vary.

Much of the fun code inside HiveMind is to allow for this; that the
same proxy can propogate around the service implementations, or be
exposed to the client application via Registry.getService() and it
will always Just Work, even accounting for things like interceptors,
just-in-time service creations, and various service models.


On Thu, 11 Nov 2004 09:37:54 +0100, Knut Wannheden
<kn...@gmail.com> wrote:
> Igor,
> 
> If you're not using HiveMind's threaded or pooled service models for
> your service you should always get back the same instance.  Provided
> that you invoke getService(Class) on the same Registry object, of
> course :-)
> 
> With the threaded and pooled service models you might get a different
> instance depending on what thread is making the call.
> 
> Hope this helps,
> 
> --knut
> 
> 
> 
> On Thu, 11 Nov 2004 11:55:05 +0300, Igor A. Deruga <in...@hotbox.ru> wrote:
> > Good *, dear fellow programmers!
> >
> > As far as I know, avalon's ServiceManager.lookup method returns an instance of
> > some class. When I invoke it for the second time, it returns me the SAME
> > instance. How do I get this result with Registry class implemented in
> > HiveMind? Registry.getService(Class cls) returns me the knew instance every
> > time. I can write a wrapper with Map, but I think there should be a way...
> > Maybe, I'm wrong in some point?
> >
> > Sincerely
> >         Igor
> >
> > ---------------------------------------------------------------------
> > 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