aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2011-03-07 23:32:46 (EST)
committerGlyn Normington2011-03-07 23:32:46 (EST)
commit2ff023daf9895f719a42ce74ca4d1cf6729b03ba (patch)
tree024161a561772568796adf0b909e8cece210f945
parent6fd054f67812fc701efc925eba5c61b4f8edefc0 (diff)
downloadorg.eclipse.virgo.kernel-2ff023daf9895f719a42ce74ca4d1cf6729b03ba.zip
org.eclipse.virgo.kernel-2ff023daf9895f719a42ce74ca4d1cf6729b03ba.tar.gz
org.eclipse.virgo.kernel-2ff023daf9895f719a42ce74ca4d1cf6729b03ba.tar.bz2
Fix service find hook to share services from shared bundles.
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManager.java2
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionServiceFindHook.java16
2 files changed, 3 insertions, 15 deletions
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManager.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManager.java
index d20c19a..25ac96b 100644
--- a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManager.java
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManager.java
@@ -95,7 +95,7 @@ final class RegionManager {
registerBundleEventHook(new RegionBundleEventHook(regionDigraph, bundleFindHook, this.threadLocal));
- RegionServiceFindHook serviceFindHook = new RegionServiceFindHook(regionDigraph, bundleFindHook);
+ RegionServiceFindHook serviceFindHook = new RegionServiceFindHook(regionDigraph);
registerServiceFindHook(serviceFindHook);
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionServiceFindHook.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionServiceFindHook.java
index 66e7bb0..2f8da5b 100644
--- a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionServiceFindHook.java
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionServiceFindHook.java
@@ -38,11 +38,9 @@ import org.osgi.framework.hooks.service.FindHook;
public final class RegionServiceFindHook implements FindHook {
private final RegionDigraph regionDigraph;
- private final org.osgi.framework.hooks.bundle.FindHook bundleFindHook;
- public RegionServiceFindHook(RegionDigraph regionDigraph, org.osgi.framework.hooks.bundle.FindHook bundleFindHook) {
+ public RegionServiceFindHook(RegionDigraph regionDigraph) {
this.regionDigraph = regionDigraph;
- this.bundleFindHook = bundleFindHook;
}
/**
@@ -61,16 +59,6 @@ public final class RegionServiceFindHook implements FindHook {
}
Set<ServiceReference<?>> allowed = getAllowed(finderRegion, references, new HashSet<Region>());
- Collection<Bundle> registrant = new ArrayList<Bundle>(1);
- for (ServiceReference<?> reference : references) {
- if (allowed.contains(reference))
- continue;
- registrant.clear();
- registrant.add(reference.getBundle());
- bundleFindHook.find(context, registrant);
- if (!registrant.isEmpty())
- allowed.add(reference);
- }
references.retainAll(allowed);
}
@@ -112,7 +100,7 @@ public final class RegionServiceFindHook implements FindHook {
Iterator<ServiceReference<?>> i = references.iterator();
while (i.hasNext()) {
ServiceReference<?> sr = i.next();
- if (!filter.isServiceAllowed(sr)) {
+ if (!filter.isServiceAllowed(sr) && !filter.isBundleAllowed(sr.getBundle())) {
i.remove();
}
}