[jboss-cvs] JBossAS SVN: r95869 - projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Oct 30 15:52:35 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-10-30 15:52:35 -0400 (Fri, 30 Oct 2009)
New Revision: 95869
Modified:
projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java
Log:
Use the bundle with the highest id
Modified: projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java 2009-10-30 19:48:35 UTC (rev 95868)
+++ projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java 2009-10-30 19:52:35 UTC (rev 95869)
@@ -73,13 +73,13 @@
throw new IllegalArgumentException("Null BundleContext");
if (mbeanServer == null)
throw new IllegalArgumentException("Null MBeanServer");
-
+
if (context.getBundle().getBundleId() != 0)
throw new IllegalArgumentException("Not the system bundle context: " + context);
-
+
this.context = context;
this.mbeanServer = mbeanServer;
-
+
this.bundleTracker = new ManagedBundleTracker(context, mbeanServer);
}
@@ -100,9 +100,19 @@
{
// [TODO] Support bundle version
if (names.size() > 1)
- throw new IllegalArgumentException("Multiple bundles found: " + names);
+ log.warn("Multiple bundles found: " + names);
- oname = names.iterator().next();
+ // Use the bundle with the highest id
+ for (ObjectName aux : names)
+ {
+ if (oname == null)
+ oname = aux;
+
+ Integer bestId = new Integer(oname.getKeyProperty(PROPERTY_ID));
+ Integer auxId = new Integer(aux.getKeyProperty(PROPERTY_ID));
+ if (bestId < auxId)
+ oname = aux;
+ }
}
return oname;
@@ -213,7 +223,7 @@
{
// Start tracking the bundles
bundleTracker.open();
-
+
try
{
if (mbeanServer != null)
More information about the jboss-cvs-commits
mailing list