[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] Should multiple versions of a fragment be allowed to attach to the same host?


Does it make sense to allow multiple versions of a fragment to attach to the same host at the same time?  The OSGi specification currently does not prohibit this.  Scenarios that fragments are typically used for, native code and NLS properties, do not usually want multiple versions of a fragment attached to the same host.  This is a little different than the current "singleton" concept in OSGi.  Consider the following scenario:

There is a bundle "my.bundle.library" version 1.0.0 that provides a simple library (no native code).  On some platforms native code may be delivered to enhance performance or provide platform specific support.  For example, on linux x86 there could be a fragment bundle my.bundle.library.linux.x86 that delivers native code that can only be used on an x86 linux platform.

What happens if more than one version of the my.bundle.library.linux.x86 fragment are installed that can resolve to the same host?

Bundle-SymbolicName: my.bundle.library.linux.x86
Bundle-Version: 1.0.0
Fragment-Host: my.bundle.library; version="[1.0.0,1.1.0)"

Bundle-SymbolicName: my.bundle.library.linux.x86
Bundle-Version: 1.0.1
Fragment-Host: my.bundle.library; version="[1.0.0,1.1.0)"

In Equinox it all depends on the order in which the fragment bundles were installed.  The framework searches the resolved fragment bundles for native code in the order they were installed.  If 1.0.0 version of my.bundle.library.linux.x86 is installed first it will always be searched before version 1.0.1.  This will force the old 1.0.0 native code to be loaded instead of the 1.0.1 version.  In this case it can be considered a configuration error.  The management agent probably should have updated the my.bundle.library.linux.x86 to version 1.0.1 instead of installing a completely new version and leaving the 1.0.0 version installed.

But is this really the desired behavior?  I ask this here before going to OSGi because I want to know if current Equinox users/developers are depending on this behavior.  Are there any scenarios we can think of that depend on multiple versions of the same fragment being attached to the same host bundle at the same time?

If you are interested in seeing where this behavior can cause issues see https://bugs.eclipse.org/bugs/show_bug.cgi?id=182805.

Tom