Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2011-04-19 21:06:34 +0000
committerThomas Watson2011-04-19 21:06:34 +0000
commit1aed9ae4754f694e3791cc687f68aa597fc9d4d3 (patch)
treec6a3c7fc6fe13f6f6e1185b20b31719feb724f4a /bundles/org.eclipse.equinox.region
parent296fd17805ce567cdcc53971f5abe73967c13d48 (diff)
downloadrt.equinox.bundles-1aed9ae4754f694e3791cc687f68aa597fc9d4d3.tar.gz
rt.equinox.bundles-1aed9ae4754f694e3791cc687f68aa597fc9d4d3.tar.xz
rt.equinox.bundles-1aed9ae4754f694e3791cc687f68aa597fc9d4d3.zip
Bug 343315 - [region] mbeans should have a frameworkUUID attribute
Diffstat (limited to 'bundles/org.eclipse.equinox.region')
-rw-r--r--bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/management/RegionObjectNameCreator.java12
-rw-r--r--bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/management/StandardManageableRegionDigraph.java36
2 files changed, 21 insertions, 27 deletions
diff --git a/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/management/RegionObjectNameCreator.java b/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/management/RegionObjectNameCreator.java
index 7146c0e1c..4ef86b653 100644
--- a/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/management/RegionObjectNameCreator.java
+++ b/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/management/RegionObjectNameCreator.java
@@ -11,10 +11,9 @@
package org.eclipse.equinox.internal.region.management;
-import org.eclipse.equinox.region.management.ManageableRegion;
-
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
+import org.eclipse.equinox.region.management.ManageableRegion;
/**
* {@link RegionObjectNameCreator} is responsible for creating {@link ObjectName}s for {@link ManageableRegion}s.
@@ -26,14 +25,19 @@ import javax.management.ObjectName;
final class RegionObjectNameCreator {
private final String domain;
+ private final String frameworkUUID;
- RegionObjectNameCreator(String domain) {
+ RegionObjectNameCreator(String domain, String frameworkUUID) {
this.domain = domain;
+ this.frameworkUUID = frameworkUUID;
}
ObjectName getRegionObjectName(String regionName) {
try {
- return new ObjectName(this.domain + ":type=Region,name=" + regionName);
+ String name = this.domain + ":type=Region,name=" + regionName;
+ if (frameworkUUID != null)
+ name += ",frameworkUUID=" + frameworkUUID;
+ return new ObjectName(name);
} catch (MalformedObjectNameException e) {
e.printStackTrace();
return null;
diff --git a/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/management/StandardManageableRegionDigraph.java b/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/management/StandardManageableRegionDigraph.java
index f6063dade..a383d9f8a 100644
--- a/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/management/StandardManageableRegionDigraph.java
+++ b/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/management/StandardManageableRegionDigraph.java
@@ -11,32 +11,16 @@
package org.eclipse.equinox.internal.region.management;
+import java.lang.management.ManagementFactory;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+import javax.management.*;
import org.eclipse.equinox.internal.region.RegionLifecycleListener;
-
import org.eclipse.equinox.region.Region;
import org.eclipse.equinox.region.RegionDigraph;
import org.eclipse.equinox.region.management.ManageableRegion;
import org.eclipse.equinox.region.management.ManageableRegionDigraph;
-
-import java.util.Collection;
-
-import org.osgi.framework.ServiceRegistration;
-
-import java.lang.management.ManagementFactory;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanRegistrationException;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-import org.osgi.framework.BundleContext;
+import org.osgi.framework.*;
/**
* {@link StandardManageableRegionDigraph} is a {@link ManageableRegionDigraph} that delegates to the
@@ -66,6 +50,8 @@ public final class StandardManageableRegionDigraph implements ManageableRegionDi
private ServiceRegistration<RegionLifecycleListener> listenerRegistration;
+ private final String frameworkUUID;
+
private final RegionLifecycleListener regionLifecycleListener = new RegionLifecycleListener() {
public void regionAdded(Region region) {
@@ -81,11 +67,15 @@ public final class StandardManageableRegionDigraph implements ManageableRegionDi
public StandardManageableRegionDigraph(RegionDigraph regionDigraph, String domain, BundleContext bundleContext) {
this.regionDigraph = regionDigraph;
this.domain = domain;
- this.regionObjectNameCreator = new RegionObjectNameCreator(domain);
this.bundleContext = bundleContext;
this.mbeanServer = ManagementFactory.getPlatformMBeanServer();
+ this.frameworkUUID = bundleContext.getProperty(Constants.FRAMEWORK_UUID);
+ this.regionObjectNameCreator = new RegionObjectNameCreator(domain, this.frameworkUUID);
try {
- mbeanName = new ObjectName(this.domain + ":type=RegionDigraph");
+ String name = this.domain + ":type=RegionDigraph";
+ if (frameworkUUID != null)
+ name += ",frameworkUUID=" + frameworkUUID;
+ mbeanName = new ObjectName(name);
} catch (MalformedObjectNameException e) {
e.printStackTrace();
throw new RuntimeException("Invalid domain name '" + this.domain + "'", e);

Back to the top