less fragile tests

Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
Greg Wilkins 2018-02-20 13:49:41 +11:00
parent 386dfc0331
commit 3ae713f2d4
1 changed files with 3 additions and 3 deletions

View File

@ -150,7 +150,7 @@ public class ExecutionStrategyTest
public void blockingProducerTest() throws Exception public void blockingProducerTest() throws Exception
{ {
final int TASKS = 3*_threads.getMaxThreads(); final int TASKS = 3*_threads.getMaxThreads();
final BlockingQueue<CountDownLatch> q = new ArrayBlockingQueue<>(500); final BlockingQueue<CountDownLatch> q = new ArrayBlockingQueue<>(_threads.getMaxThreads());
Producer producer = new TestProducer() Producer producer = new TestProducer()
{ {
@ -163,7 +163,7 @@ public class ExecutionStrategyTest
{ {
try try
{ {
final CountDownLatch latch = q.poll(10,TimeUnit.SECONDS); final CountDownLatch latch = q.take();
if (latch!=null) if (latch!=null)
{ {
@ -215,6 +215,6 @@ public class ExecutionStrategyTest
} }
}); });
assertTrue(latch.await(10,TimeUnit.SECONDS)); assertTrue(latch.await(30,TimeUnit.SECONDS));
} }
} }