Start level thread should catch exceptions to avoid terminating. (FELIX-3348)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1243546 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/FrameworkStartLevelImpl.java b/framework/src/main/java/org/apache/felix/framework/FrameworkStartLevelImpl.java
index dcb5fcc..da1fb43 100644
--- a/framework/src/main/java/org/apache/felix/framework/FrameworkStartLevelImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/FrameworkStartLevelImpl.java
@@ -292,7 +292,24 @@
if (request instanceof Integer)
{
// Set the new framework start level.
- m_felix.setActiveStartLevel(((Integer) request).intValue(), listeners);
+ try
+ {
+ m_felix.setActiveStartLevel(((Integer) request).intValue(), listeners);
+ }
+ catch (IllegalStateException ise)
+ {
+ // Thrown if global lock cannot be acquired, in which case
+ // just retry.
+ synchronized (m_requests)
+ {
+ m_requests.add(0, request);
+ }
+ }
+ catch (Exception ex)
+ {
+ m_felix.getLogger().log(Logger.LOG_ERROR,
+ "Unexpected problem setting active start level to " + request, ex);
+ }
}
else
{