You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rh...@apache.org on 2008/05/13 20:38:37 UTC
svn commit: r655964 -
/incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/testutil/QpidTestCase.java
Author: rhs
Date: Tue May 13 11:38:37 2008
New Revision: 655964
URL: http://svn.apache.org/viewvc?rev=655964&view=rev
Log:
QPID-1053: add a timeout in case the broker is never ready
Modified:
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/testutil/QpidTestCase.java
Modified: incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/testutil/QpidTestCase.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/testutil/QpidTestCase.java?rev=655964&r1=655963&r2=655964&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/testutil/QpidTestCase.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/testutil/QpidTestCase.java Tue May 13 11:38:37 2008
@@ -27,6 +27,7 @@
import java.util.List;
import java.util.StringTokenizer;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
import org.apache.qpid.client.transport.TransportConnection;
import org.apache.qpid.client.AMQConnection;
@@ -187,11 +188,15 @@
this(in, null);
}
- public void await() throws InterruptedException
+ public boolean await(long timeout, TimeUnit unit) throws InterruptedException
{
- if (latch != null)
+ if (latch == null)
{
- latch.await();
+ return true;
+ }
+ else
+ {
+ return latch.await(timeout, unit);
}
}
@@ -242,7 +247,13 @@
System.getProperty(BROKER_READY));
p.start();
- p.await();
+
+ if (!p.await(30, TimeUnit.SECONDS))
+ {
+ _logger.info("broker failed to become ready");
+ cleanBroker();
+ throw new RuntimeException("broker failed to become ready");
+ }
try
{