int (@NotNull PsiFile file, List<PsiMember> members, SearchScope scope) { Project project = file.getProject(); ProgressIndicator progress = ObjectUtils.notNull(ProgressIndicatorProvider.getGlobalProgressIndicator(), /*todo remove*/new EmptyProgressIndicator()); AtomicInteger totalUsageCount = new AtomicInteger(); JobLauncher.getInstance().invokeConcurrentlyUnderProgress(members, progress, member -> { int count = usagesCount(project, file, member, scope, progress); int newCount = totalUsageCount.updateAndGet(old -> count == TOO_MANY_USAGES ? TOO_MANY_USAGES : old + count); return newCount != TOO_MANY_USAGES; }); return totalUsageCount.get(); }