Hi,

I'm not so sure if this is a great idea, but nevertheless I want to
share it with you :)

Usually when we're using DS with a reference of cardinality
multiplicity, we need a lot of code to handle this case. As we often
have a cardinality of 0..n for the reference, it means that services can
be bound before or after the component is activated - especially the
before is the harder part. (Well, it's not rocket science but anyway it
takes some lines of code)
And in most cases, we want to have the services ordered by service
ranking, so whenever a service arrives or disappears we have to update
and sort the array (ok when removing we don't need to resort).

If I compare this to the nice and easy service tracker, I'm always
tempted to use that one instead (which of course I can do as I can mix
things).

So, what do you think about an alternative way of binding services?
Instead of having a bind/unbind method which gets a single reference,
having a method which gets a sorted array, like

   void bindServices(ServiceReference[] refs)

or

   void bindServices(ServiceInterface[] services)

So, in this case, there is no unbind method, but just this single method
that gets called everytime the reference changes.

That's just a rouhg idea. WDYT?

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

Reply via email to