-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Labels
Description
As you yourself apparently noted at https://www.planetgeek.ch/2009/08/25/how-to-find-a-concurrency-bug-with-java/ :
This pattern looks similar to what was generalized into the ConcurrentUnit library for testing multi-threaded code
But there's one thing missing, this part from the article:
// wait until all threads are ready
assertTrue("Timeout initializing threads! Perform long lasting initializations before passing runnables to assertConcurrent", allExecutorThreadsReady.await(runnables.size() * 10, TimeUnit.MILLISECONDS));
// start all test runners
afterInitBlocker.countDown();Waiting for threads' actual readiness would maximize test's chances at revealing concurrency problems.