Use property to control eager deletion of files in /tmp on binding fdb library to java

This commit is contained in:
Dan Lambright 2022-09-27 15:21:57 -04:00
parent fe4c33fabb
commit e8e1de16b6
1 changed files with 6 additions and 2 deletions

View File

@ -182,15 +182,19 @@ public class JNIUtil {
private static OS getRunningOS() {
String osname = System.getProperty("os.name").toLowerCase();
String arch = System.getProperty("os.arch");
Boolean eagerDelete = true;
if (System.getProperty("fdb.bindings.java.eager_delete") != null) {
eagerDelete = false;
}
if (!arch.equals("amd64") && !arch.equals("x86_64") && !arch.equals("aarch64") && !arch.equals("ppc64le")) {
throw new IllegalStateException("Unknown or unsupported arch: " + arch);
}
if (osname.startsWith("windows")) {
return new OS("windows", arch, /* canDeleteEager */ false);
} else if (osname.startsWith("linux")) {
return new OS("linux", arch, /* canDeleteEager */ true);
return new OS("linux", arch, /* canDeleteEager */ eagerDelete);
} else if (osname.startsWith("mac") || osname.startsWith("darwin")) {
return new OS("osx", arch, /* canDeleteEager */ true);
return new OS("osx", arch, /* canDeleteEager */ eagerDelete);
} else {
throw new IllegalStateException("Unknown or unsupported OS: " + osname);
}