You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Vinu Raj <vi...@wipro.com> on 2014/01/29 08:18:22 UTC

OSGi services and threads

I have set of services deployed using blueprint container (apache aries I
guess)  in Karaf. In some cases one service refers to another.  A few
questions regarding the threading model

Does the container create a thread per service, What is the default behavior
?
Is there way to manage threads per service ? 

regards
Vinu




--
View this message in context: http://karaf.922171.n3.nabble.com/OSGi-services-and-threads-tp4031387.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: OSGi services and threads

Posted by Christian Schneider <ch...@die-schneider.net>.
Unlike EJB OSGi does not manage threads for services. The service registry
simply returns the object that was registered as a service.
If you then use the service then this is a direct call there is no thread
boundary.

In blueprint there is a proxy object in front of each service which the
blueprint container on client side creates. This proxy mainly handles the
case of a service being unregistered or that another service is available
now. It does not interfere with threads.

So there is no pre built way of managing threads for services in OSGi. If
you need this you will have to manually implement it in your service.

Christian


2014-01-29 Vinu Raj <vi...@wipro.com>

> I have set of services deployed using blueprint container (apache aries I
> guess)  in Karaf. In some cases one service refers to another.  A few
> questions regarding the threading model
>
> Does the container create a thread per service, What is the default
> behavior
> ?
> Is there way to manage threads per service ?
>
> regards
> Vinu
>
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/OSGi-services-and-threads-tp4031387.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 
-- 
Christian Schneider
http://www.liquid-reality.de<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de>

Open Source Architect
http://www.talend.com<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.talend.com>