Hi David, great ! I'll try to do some tests this week.
regards /Pierre On Sun, Dec 16, 2012 at 6:03 AM, David Jencks <[email protected]>wrote: > I've been working on fixing the numerous timing holes in ds dependency > tracking and I think I'm getting close to being willing to commit the > results. > > I've put what I have now up at github at > https://github.com/djencks/felix.git in the service-tracker-3 branch. If > anyone is interested in taking a look that would be great. > > There are two main parts to my refactoring: > > 1. use a copy of ServiceTracker modified for the requirements of DS. > Service tracker actually tracks services properly and doesn't emit > duplicate events, miss events, etc etc. I don't think its possible to > track services properly in any simpler way. Modifications are primarily: > -a- we need a new Added event after the service is put in the tracking map > since we may want to use the event as a trigger to try to activate the > component, querying the service tracker for matching services. So the > service better be in the map :-) > -b- Closing needs to happen in 2 steps in order to deal with filter > changes. The initial close step needs to unregister the service listener > and return the current state of the map. The second close step can clear > the map. > -c- We need to expose the internal tracker for some locking. > -d- expose the tracking count. This already was in the base tracker code > but not used in ServiceTracker. we need it. This is an event counter, not > the number of tracked services. > > 2. For each component instance, keep track of the initial tracking count > when we query for existing services and the final tracking count when we > unbind services. Then we can ignore, for a given instance, events that are > "before" (have a lower tracking count than) the open and "after" (have a > higher tracking count than) the close thus avoiding duplicate and missing > bind and unbinds. > > I also put the different multiplicity/dynamic styles of reference in > separate customizer classes which I think simplifies the logic. > > There are a few other bug fixes in there too: > > FELIX-3729 > [DS] Track dependencies by imitating ServiceTracker and keeping a list of > actual service references all the time (this is most of the work) > > FELIX-3738 > [DS] ComponentInstance.getServices(String refName) is implemented wrong > for 0..1 and 1..1 refs > > FELIX-3825 > [DS] make logging more useful by including component ID when known > > > > As a side effect, a lot more of the circular reference situations are > getting resolved. I'm not entirely sure why, but I'm not objecting. > > > There are a lot (?) of unused parts of service tracker. So far I've made > minimal modifications to the copied osgi code in the interests of > maintainability in case the osgi code changes, but I could easily be talked > into removing the stuff we don't use. > > > thanks > david jencks > > > >
