|[equinox-dev] Problems with the Export-Package "uses" directive|
I am sending this note to inform the community that the Export-Package "uses" directive can critically effect the performance of the Equinox OSGi package resolver when a system contains a large set of bundles (1000s) and there are multiple exporters of the same package name. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=216934
Unfortunately this means that as a community we should *not* include any bundles that declare the Export-Package "uses" directive in the Ganymede release. Here is an example of a bundle manifest file (META-INF/MANIFEST.MF) with an Export-Package statement that contains a "uses" directive
Export-Package: com.foo; uses:="com.bar"
The Export-Package "uses" directive in OSGi is used by the Framework to ensure class space consistencies when multiple exporters of a package exist in the Framework. In the above example there may be multiple exporters of the "com.bar" package in the Framework. This Export-Package statement is informing the Framework that in order for a bundle to get wired to the "com.foo" package exported by the "foo" bundle then the importing (or requiring) bundle must be wired to the same exporter of "com.bar" as the foo bundle is.
This is essential when dealing with multiple exporters of the same package. Unfortunately the problem of resolving the state with "uses" clauses appears to be an NP-hard problem to solve. Please see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=216934 if you have ideas of how to solve such a problem.
Thanks and sorry for the inconvenience.