geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r179684 - /geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
Date Fri, 03 Jun 2005 00:38:02 GMT
Author: dain
Date: Thu Jun  2 17:38:02 2005
New Revision: 179684

URL: http://svn.apache.org/viewcvs?rev=179684&view=rev
Log:
Only try to grab a running config store

Modified:
    geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java?rev=179684&r1=179683&r2=179684&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
(original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
Thu Jun  2 17:38:02 2005
@@ -17,10 +17,13 @@
 package org.apache.geronimo.kernel.config;
 
 import java.util.Set;
+import java.util.Iterator;
 import javax.management.ObjectName;
 
 import org.apache.geronimo.kernel.jmx.JMXUtil;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.management.State;
 
 /**
  * @version $Rev$ $Date$
@@ -32,8 +35,18 @@
     }
 
     public static ConfigurationManager getConfigurationManager(Kernel kernel) {
-        // todo cache this
         Set names = kernel.listGBeans(CONFIGURATION_MANAGER_QUERY);
+        for (Iterator iterator = names.iterator(); iterator.hasNext();) {
+            ObjectName objectName = (ObjectName) iterator.next();
+            try {
+                if (kernel.getGBeanState(objectName) != State.RUNNING_INDEX) {
+                    iterator.remove();
+                }
+            } catch (GBeanNotFoundException e) {
+                // bean died
+                iterator.remove();
+            }
+        }
         if (names.isEmpty()) {
             throw new IllegalStateException("Configuration mananger could not be found in
kernel: " + CONFIGURATION_MANAGER_QUERY);
         }



Mime
View raw message