From 1d9c002a9c9632fd8219e244915763557a51ad63 Mon Sep 17 00:00:00 2001 From: Brandon Clayton <bclayton@usgs.gov> Date: Thu, 31 Aug 2023 10:44:55 -0600 Subject: [PATCH] test latch --- .../gov/usgs/earthquake/nshmp/model/NshmTests.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/test/java/gov/usgs/earthquake/nshmp/model/NshmTests.java b/src/test/java/gov/usgs/earthquake/nshmp/model/NshmTests.java index 8d033a6b..be1cd6c8 100644 --- a/src/test/java/gov/usgs/earthquake/nshmp/model/NshmTests.java +++ b/src/test/java/gov/usgs/earthquake/nshmp/model/NshmTests.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; +import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executors; import java.util.logging.Logger; @@ -143,13 +144,18 @@ class NshmTests { * Test CONUS 2018 NSHM * * To run test: ./gradlew testConus2018 + * @throws InterruptedException */ @Test - final void testConus2018() throws IOException { - var service = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); + final void testConus2018() throws IOException, InterruptedException { + var cores = Runtime.getRuntime().availableProcessors(); + var service = Executors.newFixedThreadPool(cores); + CountDownLatch latch = new CountDownLatch(1); service.execute(() -> { NshmTestUtils.testNshm(NSHMS.get("nshm-conus-2018"), Optional.ofNullable(getSite())); + latch.countDown(); }); + latch.await(); } /** -- GitLab