Java Reference
In-Depth Information
Bundle
classloader
Other bundle
classloaders
[org.osgi.*]
Bundle
System
classloader
[$CLASSPATH]
Extension
classloader
[/ext/ classes]
Boot
classloader
[java.*]
System
bundle
Wired
bundles
Attached
fragments
Figure A.3 The classloaders form a delegation chain. If a classloader can't load a given class, it
passes the request to the next classloader in the chain.
S UBSTITUTABILITY
Somewhat surprisingly, being included in a bundle doesn't guarantee that a package
will be wired to that bundle. This is a principle known as substitutability. It allows bun-
dles to maintain a consistent class space between them by standardizing on one vari-
ant of a package, even when multiple variants are exported. Figure A.4 shows the class
space for a bundle that exports a substitutable package.
Bundle B
PPa
Package X
ckage
e eX
Private
Public
Public
P i
Privat
Private
ttttt
t
Bundle A
PPa
Package Z
ckage
e eZ
PPa
Package X
ckage
e eX
Class space of bundle A
Public
Bundle C
PPa
Package Y
ckage
e e Y
Private
Figure A.4 The class space for a bundle includes all of its private classes, and the public classes of any
bundle it's wired to. It doesn't necessarily include all of the bundle's public classes, because some might
be imported from other packages instead.
 
Search WWH ::




Custom Search