Skip to content
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
18 changes: 12 additions & 6 deletions spark/src/main/java/org/apache/comet/NativeBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public abstract class NativeBase {

private static final String libraryToLoad = System.mapLibraryName(NATIVE_LIB_NAME);
private static boolean loaded = false;
private static boolean libraryLoaded = false;
private static volatile Throwable loadErr = null;
private static final String searchPattern = "libcomet-";
private static final AtomicBoolean released = new AtomicBoolean(false);
Expand Down Expand Up @@ -91,13 +92,18 @@ static synchronized void load() {
return;
}

// Try to load Comet library from the java.library.path.
try {
System.loadLibrary(NATIVE_LIB_NAME);
if (libraryLoaded) {
loaded = true;
} catch (UnsatisfiedLinkError ex) {
// Doesn't exist, so proceed to loading bundled library.
bundleLoadLibrary();
} else {
// Try to load Comet library from the java.library.path.
try {
System.loadLibrary(NATIVE_LIB_NAME);
loaded = true;
} catch (UnsatisfiedLinkError ex) {
// Doesn't exist, so proceed to loading bundled library.
bundleLoadLibrary();
}
libraryLoaded = loaded;
}

initWithLogConf();
Expand Down
Loading