activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r1425904 - in /activemq/trunk/activemq-broker/src/main/java/org/apache/activemq: broker/BrokerService.java transport/vm/VMTransportFactory.java
Date Wed, 26 Dec 2012 13:36:59 GMT
Author: dejanb
Date: Wed Dec 26 13:36:59 2012
New Revision: 1425904

URL: http://svn.apache.org/viewvc?rev=1425904&view=rev
Log:
fix for VMTransportWaitForTest test, prevent broker from being started twice

Modified:
    activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java
    activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java

Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java?rev=1425904&r1=1425903&r2=1425904&view=diff
==============================================================================
--- activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java
(original)
+++ activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java
Wed Dec 26 13:36:59 2012
@@ -471,7 +471,7 @@ public class BrokerService implements Se
     }
 
     public boolean isStarted() {
-        return started.get();
+        return started.get() && startedLatch.getCount() == 0;
     }
 
     /**
@@ -868,7 +868,7 @@ public class BrokerService implements Se
      */
     public boolean waitUntilStarted() {
         boolean waitSucceeded = false;
-        while (isStarted() && !stopped.get() && !waitSucceeded) {
+        while (!isStarted() && !stopped.get() && !waitSucceeded) {
             try {
                 if (startException != null) {
                     return waitSucceeded;

Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java?rev=1425904&r1=1425903&r2=1425904&view=diff
==============================================================================
--- activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java
(original)
+++ activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java
Wed Dec 26 13:36:59 2012
@@ -182,7 +182,7 @@ public class VMTransportFactory extends 
             broker = registry.lookup(brokerName);
             if (broker == null && waitForStart > 0) {
                 final long expiry = System.currentTimeMillis() + waitForStart;
-                while (broker == null  && expiry > System.currentTimeMillis())
{
+                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 start");



Mime
View raw message