celix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Broekhuis <a.broekh...@gmail.com>
Subject Re: Service Factory Question
Date Mon, 03 Aug 2020 14:37:32 GMT
Hi Brian,

Most of the services concepts follow the OSGi Specifications [1]. A lot of
theory can be found there.

Regarding your question, a service factory does not provide a new service
for each call, but for each service reference. So each component requesting
a service provided by a service factory, will get its own instance. This is
regardless of the usage of a service tracker or dependency manager etc.

While it is possible to get a new service for each of the calls, I wonder
if that is what you want. Reading your scenario, something like a
threadpool makes more sense. There are no restrictions to adding a
threadpool inside a component yourself, which is then used by function
handling the calls.

In utils there is a thpool implementation [2] available, which is used by
some experimental code. I personally don't have any experience with it, but
perhaps it can help you.

[1]: https://www.osgi.org/developer/specifications/
[2]: https://github.com/Pithikos/C-Thread-Pool/

Op za 1 aug. 2020 om 17:38 schreef Brian Michael <brian.m7065@gmail.com>:

> Hello,
> I have a question in regards to the service factory capabilities. I want
> to have Celix churn up a new service for each call that is coming in. An
> example would be say I have a function that is just stuck in a while loop
> for 3 minutes before it exits and it prints stuff to screen. I want to be
> able to have multiple calls coming in and running. Currently the incoming
> calls have to wait their turn in order to use the service. Does the service
> factory churn up a new service per call to take care of this or do I need
> to go another route?
> Thanks,
> Brian
> Sent from my iPhone

Met vriendelijke groet,

Alexander Broekhuis

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message