void (@NotNull ProjectTaskRunner.Result result, @NotNull Collection<? extends ProjectTask> tasks) { int inProgress = myProgressCounter.decrementAndGet(); ProjectTaskState state = new ProjectTaskState() { @Override public boolean isSkipped() { return result.isAborted(); } @Override public boolean isFailed() { return result.hasErrors(); } }; for (ProjectTask task : tasks) { myTasksState.put(task, state); } if (result.isAborted()) { myAbortedFlag.set(true); } if (result.hasErrors()) { myErrorsFlag.set(true); } if (inProgress <= 0) { try { myResultConsumer.accept(new MyResult(myContext, myTasksState, myAbortedFlag.get(), myErrorsFlag.get())); } finally { List<EventPair<?>> events = new ArrayList<>(myActivity.second); events.add(HAS_ERRORS.with(myErrorsFlag.get())); myActivity.first.finished(() -> events); } } }