Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.virgo.kernel.agent.dm')
-rw-r--r--org.eclipse.virgo.kernel.agent.dm/.classpath1
-rw-r--r--org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/DeployerFailureListener.java32
2 files changed, 29 insertions, 4 deletions
diff --git a/org.eclipse.virgo.kernel.agent.dm/.classpath b/org.eclipse.virgo.kernel.agent.dm/.classpath
index 5f209d69..779ed358 100644
--- a/org.eclipse.virgo.kernel.agent.dm/.classpath
+++ b/org.eclipse.virgo.kernel.agent.dm/.classpath
@@ -40,6 +40,7 @@
<classpathentry kind="src" path="/org.eclipse.virgo.kernel.core"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-sources-3.0.0.RELEASE.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-sources-3.0.0.RELEASE.jar"/>
+ <classpathentry kind="src" path="/org.eclipse.virgo.kernel.osgi"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse/equinox-event/1.2.100.v20101208/equinox-event-1.2.100.v20101208.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
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 cca255c7..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,13 +11,16 @@
package org.eclipse.virgo.kernel.agent.dm.internal;
+import org.eclipse.virgo.kernel.osgi.region.Region;
+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;
import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventHandler;
-import org.eclipse.virgo.medic.eventlog.EventLogger;
-
/**
* A {@link EventHandler} implementation that listens for and handles Blueprint container failure events.
* <p />
@@ -37,6 +40,10 @@ final class DeployerFailureListener implements EventHandler {
private final EventLogger eventLogger;
+ private volatile RegionDigraph regionDigraph;
+
+ private volatile Region agentRegion;
+
public DeployerFailureListener(EventLogger eventLogger) {
this.eventLogger = eventLogger;
}
@@ -55,8 +62,25 @@ final class DeployerFailureListener implements EventHandler {
}
private boolean inThisRegion(Bundle bundle) {
- Bundle agentBundle = FrameworkUtil.getBundle(getClass());
- return agentBundle.getBundleContext().getBundle(bundle.getBundleId()) == bundle;
+ if (regionDigraph == null) {
+ Bundle agentBundle = FrameworkUtil.getBundle(getClass());
+ BundleContext bundleContext = agentBundle.getBundleContext();
+ ServiceReference<RegionDigraph> regionMembershipServiceReference = bundleContext.getServiceReference(RegionDigraph.class);
+ if (regionMembershipServiceReference != null) {
+ this.regionDigraph = bundleContext.getService(regionMembershipServiceReference);
+ this.agentRegion = getRegion(agentBundle);
+ }
+ }
+ 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