Hi Bertrand,
2013/12/31 Bertrand Delacretaz <[email protected]> > > > I don't understand why the service object cannot be used as a key. > First of all you would have to use an identity map as you can't expect that the HC implements equals/hashCode correctly. But more important you don't know how the HC service is implemented, is it a singleton, a service factory or (new with OSGi R6) a prototype? If it's not a singleton you end up with different objects for the same hc, so caching based on this would simply not work. Carsten > > In my SLING-3278-bertrand.patch the HealthCheckExecutorImpl maintains > a Map<HealthCheck, HealthCheckExecutionWrapper> and uses a > ServiceTracker to make sure there's exactly one entry in this map per > registered HealthCheck service. You can search for "wrappers" at [1] > to see how that works. > > Then, when executing an HC, its value is used to retrieve the > corresponding wrapper and all is well - the wrapper can then take care > of Futures, cache management etc. > > What's the problem with that? > > -Bertrand > > [1] > https://issues.apache.org/jira/secure/attachment/12619079/SLING-3278-bertrand.patch > -- Carsten Ziegeler [email protected]
