Hi,

I’m looking for a solution, but cannot come up with one. Here is the scenario:

I have a BundleTracker to track bundles with a certain header, i.e. 
implementing an extender. The extender is interested in 
RESOLVED|STARTING|ACTIVE|STOPPING.

When a bundle is installed, but not started, the addingBundle() is called and 
the extender processes the bundle. Now, I want to start the bundle based on 
whether it is configured to be started or not, i.e. I am looking at CM 
configuration to determine whether to start the bundle or not.

Now, here’s the problem: You cannot start the bundle in the callback of 
BundleTrackerCustomizer.addingBundle().
If you do, the bundle will start, but your Tracker will not receive any events 
for the Bundle, since it hasn’t returned yet from the addingBundle() callback 
to indicate interest in the Bundle.
What I need here is to be able to return from the addingBundle() callback to 
indicate interest and then trigger the start of the Bundle.

How do I do that?

This is event driven. The callback to addingBundle() is the main event. Now, I 
need another event that the bundle is tracked in order to trigger the start 
such that the same extender BundleTrackerCustomizer starts receiving the events 
for the start of the Bundle.

Any ideas, anyone?

Thanks,

    Tim.

P.S: I doubt that setting the start level would help here. Since the 
BundleTrackerCustomizer.addingBundle() call hasn’t returned yet, it will not 
receive any events for the Bundle. Even if the start level is changed by 
another thread, there is no guarantee that the BundleTracker returns before the 
start level thread starts the bundle.
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to