void (final @NotNull TaskInfo task) { WeakList<TaskInfo> finished = myFinished; if (finished == null) { synchronized (getLock()) { finished = myFinished; if (finished == null) { myFinished = finished = new WeakList<>(); } } } if (!finished.addIfAbsent(task)) return; doDelegateRunningChange(each -> each.finish(task)); }