Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
wForget committed Aug 22, 2024
1 parent e37ea35 commit 9b407a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,10 @@ class VeloxListenerApi extends ListenerApi with Logging {
JniLibLoader.loadFromPath(libPath, false)
} else {
val baseLibName = conf.get(GlutenConfig.GLUTEN_LIB_NAME, "gluten")
loader.mapAndLoad(java.util.Optional.of(baseLibPackage), baseLibName, false)
loader.mapAndLoad(java.util.Optional.of(baseLibPackage), VeloxBackend.BACKEND_NAME, false)
loader.mapAndLoad(s"$baseLibPackage/${System.mapLibraryName(baseLibName)}", false)
loader.mapAndLoad(
s"$baseLibPackage/${System.mapLibraryName(VeloxBackend.BACKEND_NAME)}",
false)
}

// Initial native backend with configurations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.Vector;

Expand Down Expand Up @@ -159,17 +158,10 @@ public static void unloadFromPath(String libPath) {
}
}

public void mapAndLoad(String unmappedLibName, boolean requireUnload) {
mapAndLoad(Optional.empty(), unmappedLibName, requireUnload);
}

public void mapAndLoad(
Optional<String> packagePath, String unmappedLibName, boolean requireUnload) {
public void mapAndLoad(String unmappedLibPath, boolean requireUnload) {
synchronized (loadedLibraries) {
try {
final String mappedLibName = System.mapLibraryName(unmappedLibName);
String resourceName = packagePath.map(p -> p + "/" + mappedLibName).orElse(mappedLibName);
load(resourceName, requireUnload);
load(unmappedLibPath, requireUnload);
} catch (Exception e) {
throw new GlutenException(e);
}
Expand Down

0 comments on commit 9b407a2

Please sign in to comment.