void (@NotNull List<? extends Runnable> tasks) { if (tasks.isEmpty()) return; if (tasks.size() == 1 || ApplicationManager.getApplication().isWriteAccessAllowed() || DumbServiceImpl.isSynchronousTaskExecution()) { for (Runnable r : tasks) r.run(); return; } ConcurrentLinkedQueue<Runnable> tasksQueue = new ConcurrentLinkedQueue<>(tasks); FilesScanExecutor.runOnAllThreads(() -> { Runnable runnable; while ((runnable = tasksQueue.poll()) != null) runnable.run(); }); }