/*
* Create and submit to the executor 10 tasks
*/
for (int i=0; i<10; i++) {
SleepTwoSecondsTask task=new SleepTwoSecondsTask();
Future<String> result=myExecutor.submit(task);
results.add(result);
}
/*
* Get the result of the execution of the first five tasks