jaf-api icon indicating copy to clipboard operation
jaf-api copied to clipboard

Use OSGi service loader mediator instead of osgi resource locator

Open mnlipp opened this issue 3 years ago • 1 comments

When separating the api and the implementation, the service loader was introduced. This perfectly well suited mechanism is known to have problems in OSGi environments.

To overcome this, https://github.com/eclipse-ee4j/jaf/commit/4d84d6b7d30681d0cc8b4c1e4d1c93c84049aa1c added the hk2osgi service locator, which requires lots of special coding.

The problem has actually successfully been addressed before by http://docs.osgi.org/specification/osgi.enterprise/7.0.0/service.loader.html with the reference implementation (with an easier to read description) SPI Fly. What it boils down to is that instead of having to maintain the complicated code, you can simply use the service locator after adding some statements to MANIFEST.MF.

While these is not a runtime bug, because you can use Jakarta activation in an OSGi environment (once you have found out that you need to include the hk2 jar), I think it is a bug with respect to the design.

mnlipp avatar Sep 10 '22 06:09 mnlipp

Yes, this would be really helpful! +1 from me

juergen-albert avatar Oct 28 '22 11:10 juergen-albert