From 35c90e29379f29392f4be567966eb2a87a970ba9 Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Mon, 22 Jan 2007 11:14:53 +0000
Subject: [PATCH] Fix a problem in the synchronization stress test where the main thread was not waiting for the reader thread to complete it's job before returning the number of message read thus causing the test to fail
---
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/StressTest.java | 36 ++++++++++++++----------------------
1 files changed, 14 insertions(+), 22 deletions(-)
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/StressTest.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/StressTest.java
index 9e31a81..44f392c 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/StressTest.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/StressTest.java
@@ -118,19 +118,6 @@
try {
/*
- * loop receiving update until there is nothing left
- * to make sure that message from previous tests have been consumed.
- */
- try
- {
- while (true)
- {
- broker.receive();
- }
- }
- catch (Exception e)
- { }
- /*
* Test that operations done on this server are sent to the
* changelog server and forwarded to our changelog broker session.
*/
@@ -376,7 +363,10 @@
break;
count ++;
}
- } catch (Exception e) {
+ } catch (Exception e)
+ {}
+ finally
+ {
synchronized (this)
{
finished = true;
@@ -393,16 +383,18 @@
{
synchronized (this)
{
- if (finished == true)
- return count;
- try
+ int i = 20;
+ while ((finished != true) && (i-- >0))
{
- this.wait(60);
- return count;
- } catch (InterruptedException e)
- {
- return -1;
+ try
+ {
+ this.wait(60000);
+ } catch (InterruptedException e)
+ {
+ return -1;
+ }
}
+ return count;
}
}
--
Gitblit v1.10.0