Hello everybody!

I have found some strange behavior and I need your opinion is this a bug or not.

For example, we have three bundles: A, B, C

"C" depends from "B"
"A" optionaly depends from "B"
"A" depends from "C"

I install "A" from local OBR. OBR detects that it need to install "B" and "C" too.
command for install: obr start "A" - for example.

After that I have "A", "B", "C" installed and in ACTIVE state.

Then I need o uninstall "C". I call uninstall <bundle_id>

When I uninstall "C" I call "refreshPackages()" and "B" became RESOLVED, but "A" is still in active state.

But when I install "C" again I get ClassNotFoundException, because "A" cannot resolve optional dependencies from "B". They lost after "B" became in RESOLVED state.

In details it looks like this:
C detects,that it need "A" and "B" in active state. "B" is in RESOLVED, "A" is in ACTIVE. "B" became in ACTIVE state, and "C" asks "A" for some classes. "A" need some classes from "B" through optional dependency, but it cannot find it, because wires are lost because of "optional" flag and when "B" became RESOLVED, "A" lost it's wires.

Spec says:
"Optional imports can be specified in the following ways:

. Dynamic Imports -- The DynamicImport-Package header is intended to
look for an exported package when that package is needed. The key use
case for dynamic import is the Class forName method when a bundle
does not know in advance the class name it may be requested to load.
. Resolution Directive -- The resolution directive on an import definition
specifying the value optional. A bundle may successfully resolve if a
suitable optional package is not present.

/The key difference between these two mechanisms is when the wires are
made. An attempt is made to establish a wire for a dynamic import every
time there is an attempt to load a class in that package, whereas the wire for
a resolution optional package may only be established when the bundle is
resolved./"

As I understand, bundle resolves optional dependencies only when it in RESOLVED state. Is that means, that for right restart of "C" bundle, I need to restart "A" and "B" too?

What is the right way when updating bundle?

Thank for your help.
With best regards, Vadim

Reply via email to