activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r517687 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerRegistry.java
Date Tue, 13 Mar 2007 13:24:23 GMT
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);



Mime
View raw message