fix intermittent hang if all threads do not complete on time

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1296157 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2012-03-02 11:46:31 +00:00
parent 3a84de9199
commit 783ba853aa
1 changed files with 10 additions and 4 deletions

View File

@ -254,9 +254,10 @@ public class PListTest {
executor.execute(new B());
executor.shutdown();
executor.awaitTermination(30, TimeUnit.SECONDS);
boolean finishedInTime = executor.awaitTermination(30, TimeUnit.SECONDS);
assertTrue("no exceptions", exceptions.isEmpty());
assertTrue("finished ok", finishedInTime);
}
@ -287,7 +288,8 @@ public class PListTest {
}
executor.shutdown();
executor.awaitTermination(60*5, TimeUnit.SECONDS);
boolean finishedInTime = executor.awaitTermination(60*5, TimeUnit.SECONDS);
assertTrue("finished ok", finishedInTime);
}
@Test
@ -369,8 +371,9 @@ public class PListTest {
executor.shutdown();
LOG.info("wait for parallel work to complete");
executor.awaitTermination(60*5, TimeUnit.SECONDS);
boolean finishedInTime = executor.awaitTermination(60*5, TimeUnit.SECONDS);
assertTrue("no exceptions", exceptions.isEmpty());
assertTrue("finished ok", finishedInTime);
}
// for non determinant issues, increasing this may help diagnose
@ -434,8 +437,8 @@ public class PListTest {
executor.shutdown();
LOG.info("wait for parallel work to complete");
boolean shutdown = executor.awaitTermination(60*60, TimeUnit.SECONDS);
assertTrue("no exceptions: " + exceptions, exceptions.isEmpty());
assertTrue("test did not timeout ", shutdown);
assertTrue("no exceptions", exceptions.isEmpty());
}
enum TaskType {CREATE, DELETE, ADD, REMOVE, ITERATE, ITERATE_REMOVE}
@ -570,6 +573,9 @@ public class PListTest {
@After
public void tearDown() throws Exception {
if (executor != null) {
executor.shutdownNow();
}
store.stop();
exceptions.clear();
}