osgi / bugzilla-archive

Archive of OSGi Alliance Specification Bugzilla bugs. The Specification Bugzilla system was decommissioned with the move to GitHub. The issues in this repository are imported from the Specification Bugzilla system for archival purposes.
0 stars 1 forks source link

[rfc 243] Use ServiceLoader to load FrameworkUtil helpers #2999

Closed bjhargrave closed 4 years ago

bjhargrave commented 5 years ago

Original bug ID: BZ#3131 From: @tjwatson Reported version: R8

bjhargrave commented 5 years ago

Comment author: @tjwatson

For OSGi Connect RFC 243 new static methods were added to FrameworkUtil to add/remove Helper implementations:

org.osgi.framework.FrameworkUtil.addHelper(Helper) org.osgi.framework.FrameworkUtil.removeHelper(Helper)

And a new type org.osgi.framework.FrameworkUtil.Helper was added.

This approach has several concerns. It allows connect implementations to add their helpers before launching the framework but it also allows normal bundles to try to add their own helpers to static set of helpers. This should not be allowed for many reasons, such as, concerns with pinning class loaders when a bundle is uninstalled and allowing normal bundles to influence the implementation of the FrameworkUtil dynamically.

We should move the Helper type to the new org.osgi.framework.connect package as something like org.osgi.framework.connect.FrameworkUtilHelper and instead have the FrameworkUtil only use the ServiceLoader to look up a static set of Helper implementations available on the class/module path available to the class loader loading the FrameworkUtil class. Moving the type to the connect package makes it obvious this is not a type to be used by normal bundles.

bjhargrave commented 5 years ago

Comment author: @bjhargrave

+1

bjhargrave commented 5 years ago

Comment author: @rotty3000

+1

bjhargrave commented 5 years ago

Comment author: @tjwatson

I did do this update with:

https://osgi.org/gitweb/build.git/commitdiff/951dca2557cbe7b9fc0c806aed9fb9ab425a7b41?hp=5f49c44ed6d9232808b47cf6940427ddb0e4783b

Leaving open to make sure it is agreed to on an EG call that discusses RFC 243

bjhargrave commented 4 years ago

Comment author: @bjhargrave

CPEG call: Fixed.