I think you could use the existing prioritized services for this.

In the case your impls are in different bundles then each bundle could offer a marker service with different priority levels. Then both would bind the service with the highest prio. If the service aquired is their own service they would activate their ClusterService impl
if it is another one they would deactivate their impl.

So this would implement a kind of prioritized lock.

Perhaps such a pattern could be implemented as part of DS or as a helper library.

Christian


On 29.01.2014 10:14, Ioannis Canellos wrote:
In my case A and B are the standalone and clustered implementation of
a service. When the "ClusterService" becomes available I want to stop
the standalone implementation and start the clustered one.

While I am describing the real use case I realise that I could use a
single component with an optional static reference on the
"ClusterService". I could then decide if I want to "standalone" or
"clustered" behaviour by checking if the "ClusterService" is bound or
not. Using the static policy will guarantee that if the
"ClusterService" becomes available at a later point my component will
deactivate/reactivate.

In the most rare case that A was provided by a 3rd part and I was
implementing B, then I guess I would have to use enable()/disable().

Thanks


--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com

_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to