Skip to content

Commit

Permalink
More logging around intitialization
Browse files Browse the repository at this point in the history
Reviewed By: michalgr

Differential Revision: D48147590

fbshipit-source-id: e059a49ab77a55ed5aab2144ed59fdda766cdf05
  • Loading branch information
adicatana authored and facebook-github-bot committed Aug 11, 2023
1 parent 78c6c57 commit a9fcb0c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions java/com/facebook/soloader/SoLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,11 @@ public static void init(
Context context, int flags, @Nullable SoFileLoader soFileLoader, String[] denyList)
throws IOException {
if (isInitialized()) {
LogUtil.w(TAG, "SoLoader already initialized");
return;
}

LogUtil.w(TAG, "Initializing SoLoader");
StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskWrites();
try {
isEnabled = initEnableConfig(context);
Expand All @@ -278,6 +280,7 @@ public static void init(
LogUtil.v(TAG, "Init System Loader delegate");
NativeLoader.initIfUninitialized(new SystemDelegate());
}
LogUtil.w(TAG, "SoLoader initialized");
} finally {
StrictMode.setThreadPolicy(oldPolicy);
}
Expand Down Expand Up @@ -1028,12 +1031,12 @@ public static File unpackLibraryAndDependencies(String shortName) throws Unsatis
private static void doLoadLibraryBySoName(
String soName, int loadFlags, @Nullable StrictMode.ThreadPolicy oldPolicy)
throws UnsatisfiedLinkError {

sSoSourcesLock.readLock().lock();
try {
if (sSoSources == null) {
LogUtil.e(TAG, "Could not load: " + soName + " because no SO source exists");
throw new UnsatisfiedLinkError("couldn't find DSO to load: " + soName);
LogUtil.e(TAG, "Could not load: " + soName + " because SoLoader is not initialized");
throw new UnsatisfiedLinkError(
"SoLoader not initialized, couldn't find DSO to load: " + soName);
}
} finally {
sSoSourcesLock.readLock().unlock();
Expand Down

0 comments on commit a9fcb0c

Please sign in to comment.