Hi everyone,
I have an issue with different behaviours of some open source framework
bundles (Felix, Equinox, Knopflerfish) when a framework extension bundle
is updated programmatically, and wonder what the correct behaviour
should be. The spec seems contradictory regarding this. In a test
setting I have an extension bundle in two versions 0.0.1 and 0.0.2,
exporting two different packages test.pck1 and test.pck2, respectively.
Updating the extension bundle from 0.0.1 to 0.0.2 and calling
framework.refreshBundles(null) causes the framework to stop for all
three implementations. Furthermore, it causes the blocking method
framework.waitForStop(0) to return a FrameworkEvent. Then:

* Felix: FrameworkEvent is of type STOPPED_UPDATE and the framework
immediately restarts. Afterwards it exports both test.pck1 (a bug?) and
test.pck2, until restarted in a fresh VM. Then only test.pck2 is
exported.
* Knopflerfish: FrameworkEvent is of type STOPPED_UPDATE and the
framework immediately restarts. Afterwards it exports only test.pck2
* Equinox: FrameworkEvent is of type STOPPED_BOOTCLASSPATH_MODIFIED, the
framework does not restart. After a restart in a fresh JVM it exports
only test.pck2

I am wondering in particular about the two questions:
1) Which is the correct FrameworkEvent type to expect here? 
2) Should the framework restart, or simply shutdown? 

Regarding the FrameworkEvent type, the spec states (core 6.0.0, p. 105):

• STOPPED_UPDATE - This Framework object has been updated. The framework
will begin to
restart. The framework will return to its state before it was updated,
either ACTIVE or STARTING.
• STOPPED_BOOTCLASSPATH_MODIFIED - This framework object has been
stopped because a
boot class path extension bundle has been installed or updated. The VM
must be restarted in order
for the changed boot class path to take affect.


This would indicate that Felix and Knopflerfish are correct, since no
boot class path extension bundle has been updated (rather a normal
extension bundle).
On the other hand, the section on Extension Bundles states that (p. 85):

When a RESOLVED extension bundle is updated or UNINSTALLED, it is not
allowed to re-enter
the RESOLVED state. If the extension bundle is refreshed then the
Framework must shutdown;
the host VM must terminate and framework must be re-launched.

Unfortunately, it does not specify the FrameworkEvent to expect, but in
any case this is consistent with the Equinox behaviour and not with
Felix and Knopflerfish. It seems impossible to satisfy both
requirements. 

Bonus question: why does the spec insist that extension bundle updates
lead to a framework shutdown and not a restart, or why is it necessary
to restart in a fresh VM? Apparently the Knopflerfish implementation
manages to restart in the current VM with the correct package exports.
Seems to be the most convenient solution.

Thanks in advance,
Christoph

_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to