From 255cb23392b489a6b37886a0589b61a899403894 Mon Sep 17 00:00:00 2001 From: Navin Kumar Date: Mon, 20 Nov 2023 22:25:26 -0800 Subject: [PATCH] Prevent a double close of fixed transitions HCV Signed-off-by: Navin Kumar --- .../com/nvidia/spark/rapids/jni/GpuTimeZoneDB.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/nvidia/spark/rapids/jni/GpuTimeZoneDB.java b/src/main/java/com/nvidia/spark/rapids/jni/GpuTimeZoneDB.java index 0c8ab434d6..08fb9710d7 100644 --- a/src/main/java/com/nvidia/spark/rapids/jni/GpuTimeZoneDB.java +++ b/src/main/java/com/nvidia/spark/rapids/jni/GpuTimeZoneDB.java @@ -44,6 +44,8 @@ public class GpuTimeZoneDB { private CompletableFuture> zoneIdToTableFuture; private CompletableFuture fixedTransitionsFuture; + private boolean closed = false; + GpuTimeZoneDB() { zoneIdToTableFuture = new CompletableFuture<>(); fixedTransitionsFuture = new CompletableFuture<>(); @@ -246,8 +248,14 @@ private void doLoadData() { } private void close() { - try (HostColumnVector hcv = getHostFixedTransitions()) { - // automatically closed + synchronized (this) { + if (closed) { + return; + } + try (HostColumnVector hcv = getHostFixedTransitions()) { + // automatically closed + closed = true; + } } }