From c26f5a2468b74dcb41ff4c7c6565c2b2de31dd47 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Mon, 11 Dec 2017 10:09:31 -0800 Subject: [PATCH] Shutdown digester thread pool when done. Closes #89. --- src/main/java/com/threerings/getdown/data/Digest.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/threerings/getdown/data/Digest.java b/src/main/java/com/threerings/getdown/data/Digest.java index 9d085eb..0cd7a40 100644 --- a/src/main/java/com/threerings/getdown/data/Digest.java +++ b/src/main/java/com/threerings/getdown/data/Digest.java @@ -48,7 +48,8 @@ public class Digest throws IOException { // first compute the digests for all the resources in parallel - Executor exec = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); + ExecutorService exec = Executors.newFixedThreadPool( + Runtime.getRuntime().availableProcessors()); final Map digests = new ConcurrentHashMap<>(); final BlockingQueue completed = new LinkedBlockingQueue<>(); final int fversion = version; @@ -71,6 +72,9 @@ public class Digest }); } + // queue a shutdown of the thread pool when the tasks are done + exec.shutdown(); + try { while (pending.size() > 0) { Object done = completed.poll(600, TimeUnit.SECONDS);