Try to fix timout error in build

This commit is contained in:
dsyer
2009-03-20 10:30:10 +00:00
parent 2626e45995
commit 43d9e98f00

View File

@@ -95,7 +95,7 @@ public class AsynchronousTests {
}
}
List<String> list = new ArrayList<String>();
private volatile List<String> list = new ArrayList<String>();
private void assertInitialState() {
int count = simpleJdbcTemplate.queryForInt("select count(*) from T_FOOS");
@@ -120,7 +120,7 @@ public class AsynchronousTests {
container.start();
// Need to sleep for at least a second here...
Thread.sleep(1000L);
waitFor(list,2,2000);
System.err.println(simpleJdbcTemplate.queryForList("select * from T_FOOS"));
@@ -161,7 +161,7 @@ public class AsynchronousTests {
// Need to sleep here, but not too long or the
// container goes into its own recovery cycle and spits out the bad
// message...
Thread.sleep(1000L);
waitFor(list,2,2000);
container.stop();
@@ -182,4 +182,17 @@ public class AsynchronousTests {
}
/**
* @param list
* @param timeout
* @throws InterruptedException
*/
private void waitFor(List<String> list, int size, int timeout) throws InterruptedException {
int count = 0;
int max = timeout / 100;
while (count<max && list.size()<size) {
Thread.sleep(100);
}
}
}