Hi,
The "order" of the SynchronousBundleListeners is the registration order
in the framework: if you install your listener before the other, it will
be called first.
The purpose of the listener is not to "remove" bundles as you said, it's
just to listen and react.
So, the expected behavior is:
- the listener parts of bundle with "low" start level will be called
before the others, and the bundle is installed before the others and so
the listener is registered before the other.
About a kind of "addAfter/addBefore" feature, SynchronousBundleListener
(or BundleListener) is OSGi related (not Karaf related). So it's
something that can be discussed in OSGi core spec. But, I'm not sure
that it would make such sense, as you already have a workaround with the
registration order.
Regards
JB
On 09/20/2013 11:36 AM, Frizz wrote:
Hi there,
I made a SynchronousBundleListener listening for bundle 0 to detect when
the container shuts down, because I want to do some cleanup stuff before.
In theory this works.
Problem is: There are lots of other bundles that use the same
"technique" (like Camel, Blueprint, etc.). And their
SynchronousBundleListeners are called before mine is called.
At the time my SynchronousBundleListener is called a lot of the
functionality that I need is already gone.
It seems the only way to "control" the order in which
SynchronousBundleListenes are called is via the bundle start level (e.g.
etc/startup.properties).
1) I would have expected that SynchronousBundleListenes are called in
LIFO, like bundles with a high bundle start level are removed first when
then container shuts down. But that's not the case.
Imho that's a bug. What do you think?
2) It would be nice to have something like in Apache CXF: addBefore()
and addAfter() to control the order in which SynchronousBundleListenes
are called.
cheers,
F.
--
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com