You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2007/04/02 15:39:42 UTC
svn commit: r524779 -
/activemq/branches/activemq-4.1/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
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;
+ }
}
/**