Skip to content

Commit

Permalink
Improve ThreadPoolManagerTest stability (#4035)
Browse files Browse the repository at this point in the history
When the CPU load of a system is high these timeouts may not be realistic.

Fixes #3254

Signed-off-by: Wouter Born <github@maindrain.net>
  • Loading branch information
wborn authored Jan 12, 2024
1 parent 18d9b53 commit b77f954
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,15 @@ private void checkThreadPoolWorks(String poolName) throws InterruptedException {
ExecutorService threadPool = ThreadPoolManager.getPool(poolName);
CountDownLatch cdl = new CountDownLatch(1);
threadPool.execute(cdl::countDown);
assertTrue(cdl.await(1, TimeUnit.SECONDS), "Checking if thread pool " + poolName + " works");
assertTrue(cdl.await(5, TimeUnit.SECONDS), "Checking if thread pool " + poolName + " works");
assertFalse(threadPool.isShutdown(), "Checking if thread pool is not shut down");
}

private void checkScheduledPoolWorks(String poolName) throws InterruptedException {
ScheduledExecutorService threadPool = ThreadPoolManager.getScheduledPool(poolName);
CountDownLatch cdl = new CountDownLatch(1);
threadPool.schedule(cdl::countDown, 100, TimeUnit.MILLISECONDS);
assertTrue(cdl.await(1, TimeUnit.SECONDS), "Checking if thread pool " + poolName + " works");
assertTrue(cdl.await(5, TimeUnit.SECONDS), "Checking if thread pool " + poolName + " works");
assertFalse(threadPool.isShutdown(), "Checking if thread pool is not shut down");
}
}

0 comments on commit b77f954

Please sign in to comment.