BJ Hargrave wrote > Why not just store them in a SortedSet? You can use whatever Comparator > you like. bind and unbind are then very easy to implement. > > Sorting the references is rather a policy decision for the bundle. This > change does not seem to add any real value. Thanks BJ - I wasn't sure of this either - in most of these cases I'm using a sorted set or map - apart from syncing access to this data structure (read / write sync), it's not that hard to do. And introducing a new method signature might cause more problems than it solves.
Regards Carsten > -- > > *BJ Hargrave* > Senior Technical Staff Member, IBM > OSGi Fellow and CTO of the _OSGi Alliance_ <http://www.osgi.org/>_ > [email protected]_ <mailto:[email protected]> > > office: +1 386 848 1781 > mobile: +1 386 848 3788 > > > > > > > > From: Carsten Ziegeler <[email protected]> > To: OSGi Developer Mail List <[email protected]> > Date: 2011/01/14 05:45 > Subject: [osgi-dev] [DS] Improve handling of references with > cardinality multiplicity > Sent by: [email protected] > > ------------------------------------------------------------------------ > > > > 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 > > > > _______________________________________________ > OSGi Developer Mail List > [email protected] > https://mail.osgi.org/mailman/listinfo/osgi-dev -- Carsten Ziegeler [email protected] _______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
