This is an automated email from the ASF dual-hosted git repository.
agrove pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-comet.git
The following commit(s) were added to refs/heads/main by this push:
new 845b654c chore: Improve error handling when native lib fails to load
(#1000)
845b654c is described below
commit 845b654c12f80c02890371325ed3fb360a29636b
Author: Andy Grove <[email protected]>
AuthorDate: Wed Oct 23 17:56:38 2024 -0600
chore: Improve error handling when native lib fails to load (#1000)
* improve error reporting on errors loading native lib
* make variable volatile
---
common/src/main/java/org/apache/comet/NativeBase.java | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/common/src/main/java/org/apache/comet/NativeBase.java
b/common/src/main/java/org/apache/comet/NativeBase.java
index 6133a2d8..a81d45b1 100644
--- a/common/src/main/java/org/apache/comet/NativeBase.java
+++ b/common/src/main/java/org/apache/comet/NativeBase.java
@@ -46,15 +46,24 @@ public abstract class NativeBase {
private static final String libraryToLoad =
System.mapLibraryName(NATIVE_LIB_NAME);
private static boolean loaded = false;
+ private static volatile Throwable loadErr = null;
private static final String searchPattern = "libcomet-";
static {
- if (!isLoaded()) {
+ try {
load();
+ } catch (Throwable th) {
+ LOG.warn("Failed to load comet library", th);
+ // logging may not be initialized yet, so also write to stderr
+ System.err.println("Failed to load comet library: " + th.getMessage());
+ loadErr = th;
}
}
- public static synchronized boolean isLoaded() {
+ public static synchronized boolean isLoaded() throws Throwable {
+ if (loadErr != null) {
+ throw loadErr;
+ }
return loaded;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]