diff options
author | Rupert Smith <rupertlssmith@apache.org> | 2007-09-26 11:27:45 +0000 |
---|---|---|
committer | Rupert Smith <rupertlssmith@apache.org> | 2007-09-26 11:27:45 +0000 |
commit | e6ba448c493ad96c48a5a824dc589ff34b216da8 (patch) | |
tree | eebfe796f2a7cec6141e882e7dde2943ce30e102 | |
parent | 8d2fe1842ef7f844f2224734f0ce6a5777c9b637 (diff) | |
download | qpid-python-e6ba448c493ad96c48a5a824dc589ff34b216da8.tar.gz |
Added timeout to perftests, to fail tests if message loss causes test to jam.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2.1@579602 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java b/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java index bd34fd8f20..8247a7cec0 100644 --- a/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java +++ b/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java @@ -885,24 +885,8 @@ public class PingPongProducer implements Runnable /*, MessageListener*/, Excepti synchronized (_sendPauseMonitor)
{
if ((_maxPendingSize > 0) && (unreceivedSize < _maxPendingSize))
- // && (_sendPauseBarrier.getNumberWaiting() == 1))
{
- // log.debug("unreceived size estimate under limit = " + unreceivedSize);
-
- // Wait on the send pause barrier for the limit to be re-established.
- /*try
- {*/
- // _sendPauseBarrier.await();
_sendPauseMonitor.notify();
- /*}
- catch (InterruptedException e)
- {
- throw new RuntimeException(e);
- }
- catch (BrokenBarrierException e)
- {
- throw new RuntimeException(e);
- }*/
}
}
@@ -1159,12 +1143,23 @@ public class PingPongProducer implements Runnable /*, MessageListener*/, Excepti // If necessary, wait until the max pending message size comes within its limit.
synchronized (_sendPauseMonitor)
{
+ // Used to keep track of the number of times that send has to wait.
+ int numWaits = 0;
+
+ // The maximum number of waits before the test gives up and fails. This has been chosen to correspond with
+ // the test timeout.
+ int waitLimit = (int) (TIMEOUT_DEFAULT / 100);
+
while ((_maxPendingSize > 0))
{
// Get the size estimate of sent but not yet received messages.
int unreceived = _unreceived.get();
int unreceivedSize = (unreceived * ((_messageSize == 0) ? 1 : _messageSize));
+ // log.debug("unreceived = " + unreceived);
+ // log.debug("unreceivedSize = " + unreceivedSize);
+ // log.debug("_maxPendingSize = " + _maxPendingSize);
+
if (unreceivedSize > _maxPendingSize)
{
// log.debug("unreceived size estimate over limit = " + unreceivedSize);
@@ -1172,8 +1167,8 @@ public class PingPongProducer implements Runnable /*, MessageListener*/, Excepti // Wait on the send pause barrier for the limit to be re-established.
try
{
- // _sendPauseBarrier.await();
- _sendPauseMonitor.wait(1000);
+ _sendPauseMonitor.wait(100);
+ numWaits++;
}
catch (InterruptedException e)
{
@@ -1181,10 +1176,17 @@ public class PingPongProducer implements Runnable /*, MessageListener*/, Excepti Thread.currentThread().interrupt();
throw new RuntimeException(e);
}
- /*catch (BrokenBarrierException e)
+
+ // Fail the test if the send has had to wait more than the maximum allowed number of times.
+ if (numWaits >= waitLimit)
{
- throw new RuntimeException(e);
- }*/
+ String errorMessage =
+ "Send has had to wait for the unreceivedSize (" + unreceivedSize
+ + ") to come below the maxPendingSize (" + _maxPendingSize + ") more that " + waitLimit
+ + " times.";
+ log.warn(errorMessage);
+ throw new RuntimeException(errorMessage);
+ }
}
else
{
|