You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by js...@apache.org on 2007/03/13 14:24:23 UTC

svn commit: r517687 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerRegistry.java

Author: jstrachan
Date: Tue Mar 13 06:24:23 2007
New Revision: 517687

URL: http://svn.apache.org/viewvc?view=rev&rev=517687
Log:
added a helper method to access the current singleton broker

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerRegistry.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerRegistry.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerRegistry.java?view=diff&rev=517687&r1=517686&r2=517687
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerRegistry.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerRegistry.java Tue Mar 13 06:24:23 2007
@@ -18,6 +18,7 @@
 package org.apache.activemq.broker;
 
 import java.util.HashMap;
+import java.util.Iterator;
 
 /**
  * 
@@ -39,7 +40,20 @@
             return (BrokerService)brokers.get(brokerName);
         }
     }
-    
+
+    /**
+     * Returns the first registered broker found
+     */
+    public BrokerService findFirst() {
+        synchronized(mutex) {
+            Iterator iter = brokers.values().iterator();
+            while (iter.hasNext()) {
+            return (BrokerService) iter.next();
+            }
+            return null;
+        }
+    }
+
     public void bind(String brokerName, BrokerService broker) {
         synchronized(mutex) {
             brokers.put(brokerName, broker);