boolean (@NotNull CompileScope scope, final @Nullable ProgressIndicator progress) { if (LOG.isDebugEnabled()) { LOG.debug("isUpToDate operation started"); } final CompilerTask task = new CompilerTask(myProject, JavaCompilerBundle.message("classes.up.to.date.check"), true, false, false, isCompilationStartedAutomatically(scope)); final CompileContextImpl compileContext = new CompileContextImpl(myProject, task, scope, true, false); final Ref<ExitStatus> result = new Ref<>(); Runnable compileWork = () -> { ProgressIndicator indicator = compileContext.getProgressIndicator(); if (indicator.isCanceled() || myProject.isDisposed()) { return; } final BuildManager buildManager = BuildManager.getInstance(); try { buildManager.postponeBackgroundTasks(); buildManager.cancelAutoMakeTasks(myProject); TaskFuture<?> future = compileInExternalProcess(compileContext, true); if (future != null) { while (!future.waitFor(200L, TimeUnit.MILLISECONDS)) { if (indicator.isCanceled()) { future.cancel(false); } } } } catch (ProcessCanceledException ignored) { compileContext.putUserDataIfAbsent(COMPILE_SERVER_BUILD_STATUS, ExitStatus.CANCELLED); } catch (Throwable e) { LOG.error(e); } finally { ExitStatus exitStatus = COMPILE_SERVER_BUILD_STATUS.get(compileContext); task.setEndCompilationStamp(exitStatus, System.currentTimeMillis()); result.set(exitStatus); buildManager.allowBackgroundTasks(false); if (!myProject.isDisposed()) { CompilerCacheManager.getInstance(myProject).flushCaches(); } } }; if (progress != null) { // if progress explicitly specified, reuse the calling thread task.run(compileWork, null, progress); } else { task.start(compileWork, null); } if (LOG.isDebugEnabled()) { LOG.debug("isUpToDate operation finished"); } return ExitStatus.UP_TO_DATE.equals(result.get()); }