From 7765c6d486eec5fe58abc1f09140e88bcaa9439a Mon Sep 17 00:00:00 2001 From: Max Schaefer Date: Wed, 28 Nov 2018 11:01:24 +0000 Subject: [PATCH] JavaScript: Await termination of extractor threadpool. --- .../extractor/src/com/semmle/js/extractor/AutoBuild.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java b/javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java index 2f950fd832a..337ba00f61f 100644 --- a/javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java +++ b/javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java @@ -21,6 +21,7 @@ import java.util.List; import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; import java.util.stream.Stream; import com.semmle.js.extractor.ExtractorConfig.SourceType; @@ -403,8 +404,14 @@ public class AutoBuild { } private void shutdownThreadPool() { - if (threadPool != null) + if (threadPool != null) { threadPool.shutdown(); + try { + threadPool.awaitTermination(365, TimeUnit.DAYS); + } catch (InterruptedException e) { + Exceptions.ignore(e, "Awaiting termination is not essential."); + } + } } /**