Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlyn Normington2011-01-26 04:51:08 -0500
committerGlyn Normington2011-01-26 04:51:08 -0500
commit730f6d095f4d33e7155f691cd195e86b44815735 (patch)
tree32ca68884c56b4f2b5bf32c2c65f843b8af8579a /org.eclipse.virgo.kernel.agent.dm
parent8250663a67b3c2393c09bc223de3a1da82810bdb (diff)
downloadorg.eclipse.virgo.kernel-730f6d095f4d33e7155f691cd195e86b44815735.tar.gz
org.eclipse.virgo.kernel-730f6d095f4d33e7155f691cd195e86b44815735.tar.xz
org.eclipse.virgo.kernel-730f6d095f4d33e7155f691cd195e86b44815735.zip
bug 330776: use region digraph in place of region membership
Diffstat (limited to 'org.eclipse.virgo.kernel.agent.dm')
-rw-r--r--org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/DeployerFailureListener.java31
1 files changed, 15 insertions, 16 deletions
diff --git a/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/DeployerFailureListener.java b/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/DeployerFailureListener.java
index f11e0bf6..afd39bb9 100644
--- a/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/DeployerFailureListener.java
+++ b/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/DeployerFailureListener.java
@@ -11,10 +11,8 @@
package org.eclipse.virgo.kernel.agent.dm.internal;
-import org.eclipse.virgo.kernel.osgi.region.IndeterminateRegionException;
import org.eclipse.virgo.kernel.osgi.region.Region;
-import org.eclipse.virgo.kernel.osgi.region.RegionMembership;
-import org.eclipse.virgo.kernel.serviceability.Assert;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
import org.eclipse.virgo.medic.eventlog.EventLogger;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -42,7 +40,7 @@ final class DeployerFailureListener implements EventHandler {
private final EventLogger eventLogger;
- private volatile RegionMembership regionMembership;
+ private volatile RegionDigraph regionDigraph;
private volatile Region agentRegion;
@@ -64,24 +62,25 @@ final class DeployerFailureListener implements EventHandler {
}
private boolean inThisRegion(Bundle bundle) {
- if (regionMembership == null) {
+ if (regionDigraph == null) {
Bundle agentBundle = FrameworkUtil.getBundle(getClass());
BundleContext bundleContext = agentBundle.getBundleContext();
- ServiceReference<RegionMembership> regionMembershipServiceReference = bundleContext.getServiceReference(RegionMembership.class);
+ ServiceReference<RegionDigraph> regionMembershipServiceReference = bundleContext.getServiceReference(RegionDigraph.class);
if (regionMembershipServiceReference != null) {
- this.regionMembership = bundleContext.getService(regionMembershipServiceReference);
- try {
- this.agentRegion = this.regionMembership.getRegion(agentBundle);
- } catch (IndeterminateRegionException e) {
- Assert.isTrue(false, "Indeterminate agent region");
- }
+ this.regionDigraph = bundleContext.getService(regionMembershipServiceReference);
+ this.agentRegion = getRegion(agentBundle);
}
}
- try {
- return this.regionMembership != null ? this.regionMembership.getRegion(bundle).equals(this.agentRegion) : true;
- } catch (IndeterminateRegionException e) {
- return true;
+ return this.regionDigraph != null ? getRegion(bundle).equals(this.agentRegion) : true;
+ }
+
+ private Region getRegion(Bundle bundle) {
+ for (Region region : this.regionDigraph) {
+ if (region.contains(bundle)) {
+ return region;
+ }
}
+ return null;
}
}

Back to the top