The traditional way is to have all the worker tasks count down a latch when they're started and have the master thread wait on that before proceeding.
You can use test.timeout.factor to do a scaled timed wait. On Mon, Nov 9, 2015 at 8:03 AM, Jaroslav Bachorik < jaroslav.bacho...@oracle.com> wrote: > Hi Alexander, > > On 9.11.2015 16:40, Alexander Kulyakhtin wrote: > >> Hi, >> >> Could you, please, review this test-only fix: >> >> CR: https://bugs.openjdk.java.net/browse/JDK-8141591 >> Webrev: >> http://cr.openjdk.java.net/~akulyakh/8141591_01/test/javax/management/remote/mandatory/threads/ExecutorTest.java.udiff.html >> >> Before the fix, it was possible that we shut down the executor before all >> the jobs have been submitted. This resulted in RejectedExecutionException. >> We are modifying the test to wait on CountDownLatch untill all the jobs >> have completed their execute() >> > > On L175 you should be using the unbound version of await(). It would be > better to let the harness deal with the timeout. > > Otherwise it looks good. > > Cheers, > > -JB- > > >> Best regards, >> Alexander >> >> >