Various minor cleanup. (FELIX-2950)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1173299 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java b/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
index 700740e..af7cea8 100644
--- a/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
@@ -674,10 +674,10 @@
return null;
}
-// TODO: OSGi R4.3 - Should this be synchronized or should we take a snapshot?
// Thread local to detect class loading cycles.
private final ThreadLocal m_listResourcesCycleCheck = new ThreadLocal();
+// TODO: OSGi R4.3 - Should this be synchronized or should we take a snapshot?
public synchronized Collection<String> listResources(
String path, String filePattern, int options)
{
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 2585ddf..f1e71f7 100644
--- a/framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -217,6 +217,10 @@
* property is set, then it will be calculated as being relative to
* the specified root directory.
* </li>
+ * <li><tt>felix.cache.filelimit</tt> - The integer value of this string
+ * sets an upper limit on how many files the cache will open. The default
+ * value is zero, which means there is no limit.
+ * </li>
* <li><tt>felix.cache.locking</tt> - Enables or disables bundle cache locking,
* which is used to prevent concurrent access to the bundle cache. This is
* enabled by default, but on older/smaller JVMs file channel locking is
@@ -849,8 +853,6 @@
public void start(int options) throws BundleException
{
- // TODO: FRAMEWORK - For now, ignore all options when starting the
- // system bundle.
start();
}
@@ -893,8 +895,6 @@
public void stop(int options) throws BundleException
{
- // TODO: FRAMEWORK - For now, ignore all options when stopping the
- // system bundle.
stop();
}
@@ -2618,18 +2618,29 @@
try
{
bundle = new BundleImpl(this, ba);
+
+ // Extensions are handled as a special case.
+ if (bundle.isExtension())
+ {
+ m_extensionManager.addExtensionBundle(this, bundle);
+ m_resolver.addRevision(m_extensionManager.getRevision());
+ }
+
+ // Use a copy-on-write approach to add the bundle
+ // to the installed maps.
+ Map[] maps = new Map[] {
+ new HashMap<String, BundleImpl>(m_installedBundles[LOCATION_MAP_IDX]),
+ new TreeMap<Long, BundleImpl>(m_installedBundles[IDENTIFIER_MAP_IDX])
+ };
+ maps[LOCATION_MAP_IDX].put(bundle._getLocation(), bundle);
+ maps[IDENTIFIER_MAP_IDX].put(new Long(bundle.getBundleId()), bundle);
+ m_installedBundles = maps;
}
finally
{
// Always release the global lock.
releaseGlobalLock();
}
-
- if (bundle.isExtension())
- {
- m_extensionManager.addExtensionBundle(this, bundle);
- m_resolver.addRevision(m_extensionManager.getRevision());
- }
}
catch (Throwable ex)
{
@@ -2647,33 +2658,6 @@
}
}
- // Acquire global lock.
-// TODO: OSGi R4.3 - Could we do this in the above lock block?
- boolean locked = acquireGlobalLock();
- if (!locked)
- {
- // If the calling thread holds bundle locks, then we might not
- // be able to get the global lock.
- throw new IllegalStateException(
- "Unable to acquire global lock to add bundle.");
- }
- try
- {
- // Use a copy-on-write approach to add the bundle
- // to the installed maps.
- Map[] maps = new Map[] {
- new HashMap<String, BundleImpl>(m_installedBundles[LOCATION_MAP_IDX]),
- new TreeMap<Long, BundleImpl>(m_installedBundles[IDENTIFIER_MAP_IDX])
- };
- maps[LOCATION_MAP_IDX].put(bundle._getLocation(), bundle);
- maps[IDENTIFIER_MAP_IDX].put(new Long(bundle.getBundleId()), bundle);
- m_installedBundles = maps;
- }
- finally
- {
- releaseGlobalLock();
- }
-
if (bundle.isExtension())
{
m_extensionManager.startExtensionBundle(this, bundle);
diff --git a/framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java b/framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java
index ff79158..8d609ae 100644
--- a/framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java
+++ b/framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java
@@ -39,6 +39,10 @@
* properties):
* </p>
* <ul>
+ * <li><tt>felix.cache.filelimit</tt> - The integer value of this string
+ * sets an upper limit on how many files the cache will open. The default
+ * value is zero, which means there is no limit.
+ * </li>
* <li><tt>org.osgi.framework.storage</tt> - Sets the directory to use as
* the bundle cache; by default bundle cache directory is
* <tt>felix-cache</tt> in the current working directory. The value
@@ -76,7 +80,7 @@
public static final String CACHE_ROOTDIR_PROP = "felix.cache.rootdir";
public static final String CACHE_LOCKING_PROP = "felix.cache.locking";
public static final String CACHE_FILELIMIT_PROP = "felix.cache.filelimit";
- // TODO: CACHE - Remove this once we migrate the cache format.
+ // TODO: KARL/CACHE - Remove this once we migrate the cache format.
public static final String CACHE_SINGLEBUNDLEFILE_PROP = "felix.cache.singlebundlefile";
protected static transient int BUFSIZE = 4096;