mirror of https://github.com/apache/activemq.git
fix for VMTransportWaitForTest test, prevent broker from being started twice
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1425904 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4724913279
commit
428a0631d3
|
@ -471,7 +471,7 @@ public class BrokerService implements Service {
|
|||
}
|
||||
|
||||
public boolean isStarted() {
|
||||
return started.get();
|
||||
return started.get() && startedLatch.getCount() == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -868,7 +868,7 @@ public class BrokerService implements Service {
|
|||
*/
|
||||
public boolean waitUntilStarted() {
|
||||
boolean waitSucceeded = false;
|
||||
while (isStarted() && !stopped.get() && !waitSucceeded) {
|
||||
while (!isStarted() && !stopped.get() && !waitSucceeded) {
|
||||
try {
|
||||
if (startException != null) {
|
||||
return waitSucceeded;
|
||||
|
|
|
@ -182,7 +182,7 @@ public class VMTransportFactory extends TransportFactory {
|
|||
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");
|
||||
|
|
Loading…
Reference in New Issue