I need to execute some amount of tasks 4 at a time, something like this:
ExecutorService taskExecutor = Executors.newFixedThreadPool(4); while(...) { tas
Clean way with ExecutorService
List> results = null; try { List> tasks = new ArrayList<>(); ExecutorService executorService = Executors.newFixedThreadPool(4); results = executorService.invokeAll(tasks); } catch (InterruptedException ex) { ... } catch (Exception ex) { ... }