Skip to content

Commit

Permalink
Prevent a double close of fixed transitions HCV
Browse files Browse the repository at this point in the history
Signed-off-by: Navin Kumar <[email protected]>
  • Loading branch information
NVnavkumar committed Nov 21, 2023
1 parent 52ae251 commit 255cb23
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/main/java/com/nvidia/spark/rapids/jni/GpuTimeZoneDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public class GpuTimeZoneDB {
private CompletableFuture<Map<String, Integer>> zoneIdToTableFuture;
private CompletableFuture<HostColumnVector> fixedTransitionsFuture;

private boolean closed = false;

GpuTimeZoneDB() {
zoneIdToTableFuture = new CompletableFuture<>();
fixedTransitionsFuture = new CompletableFuture<>();
Expand Down Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit 255cb23

Please sign in to comment.