On 13.03.2009, at 11:28, Stéphane Amaudruz wrote:

Hi,



I think I am missing some point in iPOJO.



The use case is:

*         I have an interface, let’s say IRuleStrategy, that define
execution strategies for Rule.

* I have different implementations: Strategy1 to execute Rule on
system version1 and Strategy2 to execute Rule on system version2.

* I will create a singleton instance of each of these implementation
with IPOJO



Now in my ExecutionEngine I want to retrieve the strategy for a rule,
depending on a the system version, something as getStrategy(int version). I do not see how to do that with IPOJO component? That means how to retrieve
are component from its interface and some properties.

Nope, iPOJO relies on services for regular injection. Injecting component directly is not really supported. However, you can filter injected services. To avoid having too much services in the registry, iPOJO provides a way to isolate services inside a "private" service registry (with composites).



The only solution I think about is that the component publishes an OSGi service and then I can retrieve the service by properties. But can I avoid it and requesting component instead of service, what are the best practices? Is fear an overhead using services and also I am not confident about OSGi
service and multithreading ?

In the case of OSGi, the overhead is relatively small as you get direct references on the service (no proxy). So, once you get the service, there is no more overhead. However, synchronization can be more tricky. iPOJO simplifies this with a "thread confinement", however I'm working a another type of synchronization management.


Clement
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to