Details
-
Bug
-
Status: Resolved
-
Critical
-
Resolution: Fixed
-
framework-3.0.8
-
None
Description
In my environment, this is what's going on:
1. framework is started with start level 1.
2. bundles are installed and assigned start level varying from 2 to 4.
3. framework's start level is set to 5.
4. another bundle is installed and is assigned start level 5. This bundle is then started.
Immediately I see Bundle.STARTED event for the last bundle with start level 5 is fired. While trying to understand why certain bundles are getting started earlier than bundles with lower start levels, I stepped into Felix and found the following code:
// Check to see if the bundle's start level is greater than the
// the framework's active start level.
// TODO: STARTLEVEL - Technically, this is not correct since we could be in the
// middle of a framework start level change and we might not have yet
// reached the target start level, but we will activate the bundle anyway.
// This means the bundle will be running in a higher start level temporarily
// until the start level thread catches up.
if (bundle.getStartLevel(getInitialBundleStartLevel()) > m_targetStartLevel)
{
// Throw an exception for transient starts.
if ((options & Bundle.START_TRANSIENT) != 0)
// Ignore persistent starts.
return;
}
The above code compares against "target start level" as opposed to the "currently active start level". The comment indicates that it is a known issue, so if there is already a bug filed to this extent, please close this one as duplicate. It pretty much makes it difficult to use start level service reliably.