From 29f9b438248d638df355dae1344dee7b0f7ffa5c Mon Sep 17 00:00:00 2001 From: Keith Wall Date: Wed, 5 Nov 2014 13:42:22 +0000 Subject: NO-JIRA: [Java Tests] Increase timeout to resolve a spruious timeout on a slow CI box git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1636872 13f79535-47bb-0310-9956-ffa450edef68 --- .../configuration/updater/TaskExecutorTest.java | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'qpid/java/broker-core/src') diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/updater/TaskExecutorTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/updater/TaskExecutorTest.java index 6b53776bb6..0bbbe7bf2f 100644 --- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/updater/TaskExecutorTest.java +++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/updater/TaskExecutorTest.java @@ -105,23 +105,31 @@ public class TaskExecutorTest extends TestCase } } }; - new Thread(runnable).start(); - new Thread(runnable).start(); - assertTrue("Tasks have not been submitted", submitLatch.await(1000, TimeUnit.MILLISECONDS)); - assertTrue("The first task has not been triggered", waitForCallLatch.await(1000, TimeUnit.MILLISECONDS)); + Thread t1 = new Thread(runnable); + t1.start(); + Thread t2 = new Thread(runnable); + t2.start(); + + final long timeout = 2000l; + boolean awaitSubmissions = submitLatch.await(timeout, TimeUnit.MILLISECONDS); + assertTrue(submitLatch.getCount() + " task(s) have not been submitted within expected time", awaitSubmissions); + assertTrue("The first task has not been triggered", waitForCallLatch.await(timeout, TimeUnit.MILLISECONDS)); _executor.stopImmediately(); assertFalse("Unexpected stopped state", _executor.isRunning()); - Exception e = submitExceptions.poll(1000l, TimeUnit.MILLISECONDS); + Exception e = submitExceptions.poll(timeout, TimeUnit.MILLISECONDS); assertNotNull("The task execution was not interrupted or cancelled", e); - Exception e2 = submitExceptions.poll(1000l, TimeUnit.MILLISECONDS); + Exception e2 = submitExceptions.poll(timeout, TimeUnit.MILLISECONDS); assertNotNull("The task execution was not interrupted or cancelled", e2); assertTrue("One of the exceptions should be CancellationException:", e2 instanceof CancellationException || e instanceof CancellationException); assertTrue("One of the exceptions should be InterruptedException:", e2 instanceof InterruptedException || e instanceof InterruptedException); + + t1.join(timeout); + t2.join(timeout); } public void testStop() -- cgit v1.2.1