mirror of https://github.com/apache/activemq.git
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:
parent
a61e5bce17
commit
101a3e453a
|
@ -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.
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
@ -76,15 +77,15 @@ public class DataFileAppenderTest extends TestCase {
|
|||
final int iterations = 10;
|
||||
final CountDownLatch latch = new CountDownLatch(iterations);
|
||||
ByteSequence data = new ByteSequence("DATA".getBytes());
|
||||
for (int i=0; i<iterations; i++) {
|
||||
for (int i=0; i < iterations; i++) {
|
||||
dataManager.write(data, new Runnable() {
|
||||
public void run() {
|
||||
latch.countDown();
|
||||
}
|
||||
});
|
||||
}
|
||||
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());
|
||||
|
|
Loading…
Reference in New Issue