Removed timing dependent asserts in test that could cause intermittent failures.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@652368 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hadrian Zbarcea 2008-04-30 12:31:46 +00:00
parent a61e5bce17
commit 101a3e453a
2 changed files with 9 additions and 12 deletions

View File

@ -161,10 +161,8 @@ class DataFileAppender {
WriteCommand write = new WriteCommand(location, data, sync);
// Locate datafile and enqueue into the executor in sychronized block so
// that
// writes get equeued onto the executor in order that they were assigned
// by
// the data manager (which is basically just appending)
// that writes get equeued onto the executor in order that they were assigned
// by the data manager (which is basically just appending)
synchronized (this) {
// Find the position where this item will land at.
@ -197,10 +195,8 @@ class DataFileAppender {
WriteCommand write = new WriteCommand(location, data, onComplete);
// Locate datafile and enqueue into the executor in sychronized block so
// that
// writes get equeued onto the executor in order that they were assigned
// by
// the data manager (which is basically just appending)
// that writes get equeued onto the executor in order that they were assigned
// by the data manager (which is basically just appending)
synchronized (this) {
// Find the position where this item will land at.

View File

@ -66,7 +66,8 @@ public class DataFileAppenderTest extends TestCase {
for (int i=0; i<iterations; i++) {
dataManager.write(data, false);
}
assertTrue("writes are queued up", dataManager.getInflightWrites().size() >= iterations);
// at this point most probably dataManager.getInflightWrites().size() >= 0
// as the Thread created in DataFileAppender.enqueue() may not have caught up.
Thread.sleep(1000);
assertTrue("queued data is written", dataManager.getInflightWrites().isEmpty());
}
@ -83,8 +84,8 @@ public class DataFileAppenderTest extends TestCase {
}
});
}
assertTrue("writes are queued up", dataManager.getInflightWrites().size() >= iterations);
assertEquals("none written", iterations, latch.getCount());
// at this point most probably dataManager.getInflightWrites().size() >= 0
// as the Thread created in DataFileAppender.enqueue() may not have caught up.
Thread.sleep(1000);
assertTrue("queued data is written", dataManager.getInflightWrites().isEmpty());
assertEquals("none written", 0, latch.getCount());