void () { reDetectExecutor.execute(() -> { List<VirtualFile> files = new ArrayList<>(CHUNK_SIZE); synchronized (filesToRedetect) { for (int i = 0; i < CHUNK_SIZE; i++) { VirtualFile file = filesToRedetect.poll(); if (file == null) break; files.add(file); } } if (files.size() == CHUNK_SIZE) { awakeReDetectExecutor(); } ProgressManager.getInstance().executeNonCancelableSection(() -> reDetect(files)); }); }