When the framework is stopped, the system bundle (i.e., the framework)
should stay in the RESOVLED state, unlike normal bundles that become
UNRESOLVED and thrown away. To achieve this, Felix should overload
BundleImpl.close() to do nothing. (FELIX-2822)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1069153 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/BundleImpl.java b/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
index c41ab55..8b215c7 100644
--- a/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
@@ -97,20 +97,16 @@
synchronized void close()
{
closeModules();
- // System bundle has no archive associated with it.
- if (m_archive != null)
+ try
{
- try
- {
- m_archive.close();
- }
- catch (Exception ex)
- {
- getFramework().getLogger().log(
- this,
- Logger.LOG_ERROR,
- "Unable to close archive revisions.", ex);
- }
+ m_archive.close();
+ }
+ catch (Exception ex)
+ {
+ getFramework().getLogger().log(
+ this,
+ Logger.LOG_ERROR,
+ "Unable to close archive revisions.", ex);
}
}
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 44e261b..aa2827a 100644
--- a/framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -83,7 +83,7 @@
static final SecureAction m_secureAction = new SecureAction();
// The extension manager to handle extension bundles
- ExtensionManager m_extensionManager;
+ private final ExtensionManager m_extensionManager;
// Logging related member variables.
private final Logger m_logger;
@@ -439,6 +439,13 @@
return result;
}
+ // This overrides BundleImpl.close() which avoids removing the
+ // system bundle module from the resolver state.
+ @Override
+ void close()
+ {
+ }
+
// This overrides the default behavior of BundleImpl.getFramework()
// to return "this", since the system bundle is the framework.
Felix getFramework()