felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Meschberger <fmesc...@gmail.com>
Subject Interesting observation regarding org.osgi.framework.bootdelegation
Date Fri, 04 Jan 2008 09:19:47 GMT
Hi all,

In Apache Sling [1] we had an issue regarding classloading [2], which we
could solve by using the org.osgi.framework.bootdelegation property and
sharing a library. Even though the solution with the bootdelegation
property works, we noticed an interesting situation (see also [3]):

Consider bundle B1 exporting package P1 and Bundle B2 importing Package
P1. In addition the bootdelegation property is set to include P1.

When B2 is resolved (assuming B1 is active), the Felix framework
correctly resolves the import of P1 to the bundle B1. When a class from
P1 is accessed (in both B1 and B2), the class is of course loaded
correctly from the parent class loader as P1 is listed in the
bootdelegation property.

The question now is: Is it correct to resolve B2's import of P1 to B1 ?
Or should imported packages listed in the bootdelegation property not be
resolved to other bundles ?

My explanation would be: If you declare the import, it must be resolved,
no matter what. To prevent the resolution, the import must not be
declared. But then I assume that packages declared in the bootdelegation
property never need to be declared as imports, right ?

Is may assumption correct ?

In fact, thinking about this situation while writing it down, I am
tempted to not list P1 in the bootdelegation but in the
org.osgi.framework.system.packages property. In this case both B1 (which
also must import its own exports) and B2 would resolve P1 to the system
bundle, which would be better - from an administrative and support
perspective. WDYT ?

Thanks for any hints.


[1] http://incubator.apache.org/sling/

View raw message