You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2011/09/20 20:42:59 UTC
svn commit: r1173299 - in
/felix/trunk/framework/src/main/java/org/apache/felix/framework:
BundleWiringImpl.java Felix.java cache/BundleCache.java
Author: rickhall
Date: Tue Sep 20 18:42:59 2011
New Revision: 1173299
URL: http://svn.apache.org/viewvc?rev=1173299&view=rev
Log:
Various minor cleanup. (FELIX-2950)
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java
Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java?rev=1173299&r1=1173298&r2=1173299&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java Tue Sep 20 18:42:59 2011
@@ -674,10 +674,10 @@ public class BundleWiringImpl implements
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)
{
Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java?rev=1173299&r1=1173298&r2=1173299&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java Tue Sep 20 18:42:59 2011
@@ -217,6 +217,10 @@ public class Felix extends BundleImpl im
* 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 class Felix extends BundleImpl im
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 class Felix extends BundleImpl im
public void stop(int options) throws BundleException
{
- // TODO: FRAMEWORK - For now, ignore all options when stopping the
- // system bundle.
stop();
}
@@ -2618,18 +2618,29 @@ public class Felix extends BundleImpl im
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 @@ public class Felix extends BundleImpl im
}
}
- // 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);
Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java?rev=1173299&r1=1173298&r2=1173299&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java Tue Sep 20 18:42:59 2011
@@ -39,6 +39,10 @@ import org.osgi.framework.Constants;
* 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 class BundleCache
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;