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; + } } }