activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r524779 - /activemq/branches/activemq-4.1/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
Date Mon, 02 Apr 2007 13:39:42 GMT
Author: chirino
Date: Mon Apr  2 06:39:40 2007
New Revision: 524779

URL: http://svn.apache.org/viewvc?view=rev&rev=524779
Log:
Use a latch so that the getBrokerName() call is moreforgiving of connection establishment
timing issues. 

Modified:
    activemq/branches/activemq-4.1/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java

Modified: activemq/branches/activemq-4.1/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
URL: http://svn.apache.org/viewvc/activemq/branches/activemq-4.1/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java?view=diff&rev=524779&r1=524778&r2=524779
==============================================================================
--- activemq/branches/activemq-4.1/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
(original)
+++ activemq/branches/activemq-4.1/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
Mon Apr  2 06:39:40 2007
@@ -1370,10 +1370,16 @@
      * Returns the broker name if one is available or null if one is not available yet.
      */
     public String getBrokerName() {
-        if (brokerInfo == null) {
-            return null;
-        }
-        return brokerInfo.getBrokerName();
+        try {
+			brokerInfoReceived.await(5,TimeUnit.SECONDS);
+	        if (brokerInfo == null) {
+	            return null;
+	        }
+	        return brokerInfo.getBrokerName();
+		} catch (InterruptedException e) {
+			Thread.currentThread().interrupt();
+			return null;
+		}
     }
    
     /**



Mime
View raw message