System.out.println("bat dau chay" + Calendar.getInstance()); Callable callable1 = new Callable() { @Override public String call() throws Exception { System.out.println("task 1"); return "task --1"; } }; Callable callable2 = new Callable() { @Override public String call() throws Exception { System.out.println("task 2"); return "task --2"; } }; Callable callable3 = new Callable() { @Override public String call() throws Exception { System.out.println("task 3"); return "task --3"; } }; List<Callable> callables = new ArrayList(); callables.add(callable1); callables.add(callable2); callables.add(callable3); callables.add(callable1); callables.add(callable2); callables.add(callable3); callables.add(callable1); callables.add(callable2); callables.add(callable3); ExecutorService executorService = Executors.newFixedThreadPool(5); List<Future> futures = executorService.invokeAll(callables); for (Future f : futures) { System.out.println(f.get()); } System.out.println("ket thuc" + Calendar.getInstance()); executorService.shutdown();