Java tutorial
//package com.java2s; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; public class Main { public static void runRunnablesNTimesAndAwaitCompletion(int times, final List<Runnable> runnables) throws InterruptedException { ExecutorService newFixedThreadPool = Executors.newFixedThreadPool(runnables.size()); for (Runnable r : runnables) { for (int i = 0; i < times; i++) { newFixedThreadPool.execute(r); } } newFixedThreadPool.shutdown(); newFixedThreadPool.awaitTermination(5, TimeUnit.SECONDS); } }