Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ record FileTask(String filePath, List<CodeNode> fileNodes, LanguageExtractor ext
var edgesAdded = new java.util.concurrent.atomic.AtomicInteger(0);
var typeHintsAdded = new java.util.concurrent.atomic.AtomicInteger(0);

var executor = Executors.newVirtualThreadPerTaskExecutor();
try {
// try-with-resources: ExecutorService#close() handles shutdown + awaitTermination.
// Each future.get() below has its own 5-minute timeout + cancel, so by the time
// close() runs, all tasks are terminal and close() returns promptly.
try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {
List<Future<?>> futures = new ArrayList<>(tasks.size());
for (FileTask task : tasks) {
futures.add(executor.submit(() -> {
Expand Down Expand Up @@ -183,19 +185,6 @@ record FileTask(String filePath, List<CodeNode> fileNodes, LanguageExtractor ext
break;
}
}
} finally {
executor.shutdown();
try {
if (!executor.awaitTermination(10, TimeUnit.SECONDS)) {
executor.shutdownNow();
if (!executor.awaitTermination(5, TimeUnit.SECONDS)) {
log.warn("Language enrichment executor did not terminate cleanly");
}
}
} catch (InterruptedException e) {
executor.shutdownNow();
Thread.currentThread().interrupt();
}
}

edges.addAll(newEdges);
Expand Down
Loading