On 11/30/10 3:35, [email protected] wrote:
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.
Perhaps I'm not understanding your description above. The phrase
"depends from" doesn't really make sense. If I assume you meant "depends
on", then the above scenario should not happen, because if A depends on
C and you uninstall and refresh C, then A should not be able to resolve
at all. If I assume you meant the reverse dependency, then it doesn't
seem like the above should happen either, since B wouldn't be able to
resolve since it depends on C. So, I don't know.
Perhaps you could show a simplified version of your bundles' metadata?
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.
If you are installing a provider for an optional dependency after the
associated bundle is resolved, then it will not be seen by the bundle
with the optional dependency.
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?
Optional dependencies are only created when the bundle transitions from
INSTALLED to RESOLVED, but once in RESOLVED it will never resolve any
more optional dependencies.
What is the right way when updating bundle?
Again, I don't totally understand your scenario, so it is hard for me to
say what to do.
-> richard
Thank for your help.
With best regards, Vadim
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]