Applied patch (FELIX-168) for fine-grained spec compliance with start level
service.
git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@469621 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/Felix.java b/framework/src/main/java/org/apache/felix/framework/Felix.java
index f8c8e1d..9860cbc 100644
--- a/framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -474,17 +474,19 @@
// Set the start level using the start level service;
// this ensures that all start level requests are
// serialized.
- // NOTE: There is potentially a specification compliance
- // issue here, since the start level request is asynchronous;
- // this means that the framework will fire its STARTED event
- // before all bundles have officially been restarted and it
- // is not clear if this is really an issue or not.
try
{
StartLevel sl = (StartLevel) getService(
getBundle(0),
getServiceReferences((BundleImpl) getBundle(0), StartLevel.class.getName(), null)[0]);
- sl.setStartLevel(startLevel);
+ if (sl instanceof StartLevelImpl)
+ {
+ ((StartLevelImpl) sl).setStartLevelAndWait(startLevel);
+ }
+ else
+ {
+ sl.setStartLevel(startLevel);
+ }
}
catch (InvalidSyntaxException ex)
{
@@ -805,7 +807,10 @@
}
}
- fireFrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, getBundle(0), null);
+ if (m_frameworkStatus == RUNNING_STATUS)
+ {
+ fireFrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, getBundle(0), null);
+ }
}
/**
diff --git a/framework/src/main/java/org/apache/felix/framework/StartLevelImpl.java b/framework/src/main/java/org/apache/felix/framework/StartLevelImpl.java
index a351877..ad6d7cd 100644
--- a/framework/src/main/java/org/apache/felix/framework/StartLevelImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/StartLevelImpl.java
@@ -86,7 +86,8 @@
}
/**
- * This method is currently only called by the shutdown thread when the
+ * This method is currently only called by the by the thread that calls
+ * the Felix.start() method and the shutdown thread when the
* framework is shutting down.
* @param startlevel
**/