Skip to content

Commit

Permalink
Make the zone DB shutdown/load cycle redoable (#2567)
Browse files Browse the repository at this point in the history
Signed-off-by: Robert (Bobby) Evans <[email protected]>
  • Loading branch information
revans2 authored Nov 4, 2024
1 parent 1f0b239 commit 58b5dbf
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/main/java/com/nvidia/spark/rapids/jni/GpuTimeZoneDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,12 @@ public class GpuTimeZoneDB {
// use this reference to indicate if time zone cache is initialized.
private static HostColumnVector fixedTransitions;

private static boolean isShutdownCalledEver = false;

/**
* This should be called on startup of an executor.
* Runs in a thread asynchronously.
* If `shutdown` was called ever, then will not load the cache
*/
public static void cacheDatabaseAsync() {
// This has a race in that we could still launch a thread after
// shutting down. This is just to prevent the thread from launching
// in some cases.
synchronized (GpuTimeZoneDB.class) {
if (isShutdownCalledEver) {
log.error("cache async called after DB already loaded");
return;
}
}
// start a new thread to load
Runnable runnable = () -> {
try {
Expand Down Expand Up @@ -101,14 +90,10 @@ public static void cacheDatabase() {
* close the cache, used when Plugin is closing
*/
public static synchronized void shutdown() {
isShutdownCalledEver = true;
closeResources();
}

private static synchronized void cacheDatabaseImpl() {
if (isShutdownCalledEver) {
throw new IllegalStateException("GpuTimeZoneDB has already been shut down");
}
if (fixedTransitions == null) {
try {
loadData();
Expand Down

0 comments on commit 58b5dbf

Please sign in to comment.