re AMQ-2076, see if a little more time will help

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@745490 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2009-02-18 12:15:58 +00:00
parent 7f5e6667f4
commit 9e3e5ad4cc
1 changed files with 6 additions and 5 deletions

View File

@ -94,20 +94,21 @@ public class DataFileNotDeletedTest extends TestCase {
}
latch.await();
assertEquals(max_messages, messageCounter);
waitFordataFilesToBeCleanedUp(persistentAdapter.getAsyncDataManager(), 30000, 2);
LOG.info("Sent and received + " + messageCounter + ", file count " + persistentAdapter.getAsyncDataManager().getFiles().size());
waitFordataFilesToBeCleanedUp(persistentAdapter.getAsyncDataManager(), 60000, 2);
}
private void waitFordataFilesToBeCleanedUp(
AsyncDataManager asyncDataManager, int timeout, int numExpected) throws InterruptedException {
long expiry = System.currentTimeMillis() + timeout;
while(expiry > System.currentTimeMillis()) {
if (asyncDataManager.getFiles().size() <= numExpected) {
break;
} else {
if (asyncDataManager.getFiles().size() > numExpected) {
Thread.sleep(1000);
} else {
break;
}
}
assertEquals("persistence adapter dataManager has correct number of files", 2, asyncDataManager.getFiles().size());
assertEquals("persistence adapter dataManager has correct number of files", numExpected, asyncDataManager.getFiles().size());
}
private Connection createConnection() throws JMSException {