Repository: activemq
Updated Branches:
  refs/heads/trunk 5016c4d4f -> cfce36197


https://issues.apache.org/jira/browse/AMQ-5086

Avoid a possible uneeded wait.

Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/cfce3619
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/cfce3619
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/cfce3619

Branch: refs/heads/trunk
Commit: cfce36197e27a6758d592737c448dc01d7acc75e
Parents: 5016c4d
Author: Timothy Bish <[email protected]>
Authored: Mon Jun 9 16:21:00 2014 -0400
Committer: Timothy Bish <[email protected]>
Committed: Mon Jun 9 16:21:00 2014 -0400

----------------------------------------------------------------------
 .../activemq/transport/vm/VMTransportFactory.java      | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/cfce3619/activemq-broker/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java
----------------------------------------------------------------------
diff --git 
a/activemq-broker/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java
 
b/activemq-broker/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java
index 7bd24cf..938dc7d 100755
--- 
a/activemq-broker/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java
+++ 
b/activemq-broker/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java
@@ -85,7 +85,7 @@ public class VMTransportFactory extends TransportFactory {
                 if (config != null) {
                     brokerURI = new URI(config);
                 } else {
-                    Map brokerOptions = 
IntrospectionSupport.extractProperties(options, "broker.");
+                    Map<String, Object> brokerOptions = 
IntrospectionSupport.extractProperties(options, "broker.");
                     brokerURI = new URI("broker://()/" + host + "?"
                                         + 
URISupport.createQueryString(brokerOptions));
                 }
@@ -192,12 +192,13 @@ public class VMTransportFactory extends TransportFactory {
                 final long expiry = System.currentTimeMillis() + waitForStart;
                 while ((broker == null || !broker.isStarted()) && expiry > 
System.currentTimeMillis()) {
                     long timeout = Math.max(0, expiry - 
System.currentTimeMillis());
-                    try {
-                        LOG.debug("waiting for broker named: " + brokerName + 
" to enter registry");
-                        registry.getRegistryMutext().wait(timeout);
-                    } catch (InterruptedException ignored) {
+                    if (broker == null) {
+                        try {
+                            LOG.debug("waiting for broker named: " + 
brokerName + " to enter registry");
+                            registry.getRegistryMutext().wait(timeout);
+                        } catch (InterruptedException ignored) {
+                        }
                     }
-                    broker = registry.lookup(brokerName);
                     if (broker != null && !broker.isStarted()) {
                         LOG.debug("waiting for broker named: " + brokerName + 
" to start");
                         timeout = Math.max(0, expiry - 
System.currentTimeMillis());

Reply via email to