You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by xVik <2r...@inbox.ru> on 2006/11/15 07:48:48 UTC

how much getService coast?

how much getService(..) coast and does hivemind cashes these calls
i mean should i cashe by myself service getter:

private ISomeInterface someservice;

public ISomeInterface getSomeservice(){
    if (someservice==null)
someservice=registry.getService(ISomeInterface.class);
    return someservice;
}

or its redundant and hivemind do these work for me?

and the other question:
these is web application so on each request i have to perform
registry.setupThread();
and object with service getter stored in session.. so "cashed" service
instance would be old one

So im askng is it bad for threaded environment (and i should somehow clean
my "cash" to perform getService on each request) or its ok and all be fine

-- 
View this message in context: http://www.nabble.com/how-much-getService-coast--tf2634343.html#a7352824
Sent from the Hivemind - User mailing list archive at Nabble.com.


Re: how much getService coast?

Posted by xVik <2r...@inbox.ru>.
thanks for comment :)


Achim Hügen wrote:
> 
> Hi,
> 
>>
>> how much getService(..) coast and does hivemind cashes these calls
>> i mean should i cashe by myself service getter:
>>
>> private ISomeInterface someservice;
>>
>> public ISomeInterface getSomeservice(){
>>     if (someservice==null)
>> someservice=registry.getService(ISomeInterface.class);
>>     return someservice;
>> }
>>
>> or its redundant and hivemind do these work for me?
> 
> A getService is pretty cheap, it's just a lookup in a map.
> 
>>
>> and the other question:
>> these is web application so on each request i have to perform
>> registry.setupThread();
>> and object with service getter stored in session.. so "cashed" service
>> instance would be old one
>>
>> So im askng is it bad for threaded environment (and i should somehow  
>> clean
>> my "cash" to perform getService on each request) or its ok and all be  
>> fine
>>
> 
> I don't expect any problems with the cached service instances.
> Your objects are referencing proxies only which handle thread related
> issues in the case of a pooled or threaded service model.
> 
> Achim
> 
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/how-much-getService-cost--tf2634343.html#a7393972
Sent from the Hivemind - User mailing list archive at Nabble.com.


Re: how much getService coast?

Posted by Achim Hügen <ac...@gmx.de>.
Hi,

>
> how much getService(..) coast and does hivemind cashes these calls
> i mean should i cashe by myself service getter:
>
> private ISomeInterface someservice;
>
> public ISomeInterface getSomeservice(){
>     if (someservice==null)
> someservice=registry.getService(ISomeInterface.class);
>     return someservice;
> }
>
> or its redundant and hivemind do these work for me?

A getService is pretty cheap, it's just a lookup in a map.

>
> and the other question:
> these is web application so on each request i have to perform
> registry.setupThread();
> and object with service getter stored in session.. so "cashed" service
> instance would be old one
>
> So im askng is it bad for threaded environment (and i should somehow  
> clean
> my "cash" to perform getService on each request) or its ok and all be  
> fine
>

I don't expect any problems with the cached service instances.
Your objects are referencing proxies only which handle thread related
issues in the case of a pooled or threaded service model.

Achim