SingleTask () { ProgressIndicator indicator = myProgress.createProgressIndicator(true, INDEXING); Consumer<ProgressIndicator> task = progressIndicator -> { int previousPriority = setMinimumPriority(); try { IndexingRequest request; while ((request = popRequest()) != null) { try { request.run(progressIndicator); progressIndicator.checkCanceled(); } catch (ProcessCanceledException reThrown) { throw reThrown; } catch (Throwable t) { indicator.checkCanceled(); request.processException(t); } } } finally { taskCompleted(null); resetPriority(previousPriority); } }; Future<?> future = AppExecutorUtil.getAppExecutorService().submit(() -> { ProgressManager.getInstance().runProcess(() -> { task.accept(indicator); }, indicator); }); return new SingleTaskImpl(future, indicator); }