Is there an ExecutorService that creates a new thread for every task?

Viewed 943

I need to unit-test some functionality that works across threads, for which I need to guarantee that two jobs are run on different threads.

Using Executors.newCachedThreadPool() introduces a race-condition, because the test may or may not use the cached thread-pool.

Is there an ExecutorService that always uses a new thread?

1 Answers
Related