void () { try { try { if (myException.get() == null) { buildChunkIfAffected(chunkLocalContext, myContext.getScope(), task.getChunk(), myBuildProgress); } } finally { Tracer.Span flush = Tracer.start("flushing"); myProjectDescriptor.dataManager.closeSourceToOutputStorages(Collections.singletonList(task.getChunk())); myFlushCommand.run(); flush.complete(); } } catch (Throwable e) { myException.compareAndSet(null, e); LOG.info(e); } finally { LOG.debug("Finished compilation of " + task.getChunk().toString()); myTasksCountDown.countDown(); List<BuildChunkTask> nextTasks; nextTasks = task.markAsFinishedAndGetNextReadyTasks(); if (!nextTasks.isEmpty()) { queueTasks(nextTasks); } } }