void (SearchEverywhereContributor<?> contributor) { lock.lock(); try { finishedContributorsSet.add(contributor); runInNotificationExecutor(() -> myListener.contributorFinished(contributor, Optional.ofNullable(hasMoreMap.get(contributor)).orElse(false))); stopSearchIfNeeded(); } finally { lock.unlock(); } }