Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 18846 invoked from network); 2 Apr 2007 13:40:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Apr 2007 13:40:03 -0000 Received: (qmail 24372 invoked by uid 500); 2 Apr 2007 13:40:11 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 24320 invoked by uid 500); 2 Apr 2007 13:40:11 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 24311 invoked by uid 99); 2 Apr 2007 13:40:10 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Apr 2007 06:40:10 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Apr 2007 06:40:03 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id CC5E61A9838; Mon, 2 Apr 2007 06:39:42 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@activemq.apache.org From: chirino@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070402133942.CC5E61A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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; + } } /**