taskExecutor.setAsyncMode(false);
// Indicate to the task executor to maintain parallelism
taskExecutor.setMaintainsParallelism(true);
/* Create and launch tasks with the task executor */
FileCounterRecursiveAction task01 = new FileCounterRecursiveAction(new File("C:\\"));
FileCounterRecursiveAction task02 = new FileCounterRecursiveAction(new File("D:\\"));
FileCounterRecursiveAction task03 = new FileCounterRecursiveAction(new File("E:\\"));
// Explicit invalid path in order that the task fail !
FileCounterRecursiveAction task04 = new FileCounterRecursiveAction(new File("A:\\"));
taskExecutor.execute(task01);
taskExecutor.execute(task02);
taskExecutor.execute(task03);
taskExecutor.execute(task04);
System.out.println("Tasks launched...");