FELIX-5034 : Reduce and correct locking related to the hook registry
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1703963 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 fe4bda6..e6ad8f4 100644
--- a/framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -3280,9 +3280,7 @@
Bundle[] getBundles(BundleContext bc)
{
Collection<Bundle> bundles = m_installedBundles[IDENTIFIER_MAP_IDX].values();
- // If the requesting bundle is something other than the system bundle, return the shrunk
- // collection of bundles. If it *is* the system bundle, it should receive the unfiltered bundles.
- if ( !bundles.isEmpty() && bc.getBundle() != this )
+ if ( !bundles.isEmpty() )
{
Set<ServiceReference<org.osgi.framework.hooks.bundle.FindHook>> hooks =
getHookRegistry().getHooks(org.osgi.framework.hooks.bundle.FindHook.class);
@@ -3309,6 +3307,11 @@
}
}
}
+ if ( bc.getBundle() != this ) {
+ // If the requesting bundle is something other than the system bundle, return the shrunk
+ // collection of bundles. If it *is* the system bundle, it should receive the unfiltered bundles.
+ bundles = shrunkBundles;
+ }
}
}