ghenzler commented on PR #467: URL: https://github.com/apache/felix-dev/pull/467#issuecomment-3809737313
> use the service reference from the service event directly to avoid reaching out to the service registry again the good thing is that with the current implementation of `setupDefaultBaseUrl()`, it can be called from `activate()` (that does not have a service change event) *and* upon any service changes. Overall those service changes are rare (that the service listener will be triggered is an absolute edge case), so it doesn't make to optimise too much. More important is that it will *always* hold the correct `defaultBaseUrl`, and the current implementation will make sure that this is the case by calling it on activate *and* on service changes (so no matter if this component or the http service is initialised first, the result is always correct). > Maybe we could also use a DS service reference with a target filter instead and bind/unbind methods So https://issues.apache.org/jira/browse/FELIX-6635 (and https://github.com/apache/felix-dev/commit/866c7e7bb0f50719916b6c42a3c0be65ac96a1b5) removed the line `ServiceReference<HttpService> httpServiceReference;` - I think for this use case it does make sense to loosely couple. So overall the usual path is `activate()` -> `setupDefaultBaseUrl()` (because the http service is there already) - this path is efficient in the current PR. The service listener exists as safety net if the bundle startup order isn't fully deterministic because http service and this general checks bundle are started at the same start level (I have seen happening this in AEM 6.5 LTS). There is little reason to optimise for many http service changes that don't exist in reality. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
