Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the zone DB shutdown/load cycle re-doable #2567

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading