Synchronize before acquiring file lock
Reviewed By: dcaspi Differential Revision: D4071662 fbshipit-source-id: 3458ff103fddb82a7588d7890f8bc931c0e19e14
This commit is contained in:
Родитель
5f15554100
Коммит
cfebad97b2
|
@ -91,6 +91,9 @@ public class UnpackingJSBundleLoader extends JSBundleLoader {
|
|||
|
||||
final File lockFilePath = new File(mContext.getFilesDir(), LOCK_FILE);
|
||||
Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "UnpackingJSBundleLoader.prepare");
|
||||
|
||||
// Make sure we don't release the lock by letting other thread close the lock file
|
||||
synchronized(UnpackingJSBundleLoader.class) {
|
||||
try (FileLocker lock = FileLocker.lock(lockFilePath)) {
|
||||
unpacked = prepareLocked();
|
||||
} catch (IOException ioe) {
|
||||
|
@ -98,6 +101,7 @@ public class UnpackingJSBundleLoader extends JSBundleLoader {
|
|||
} finally {
|
||||
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||
}
|
||||
}
|
||||
|
||||
if (unpacked && mOnUnpackedCallback != null) {
|
||||
mOnUnpackedCallback.run();
|
||||
|
|
Загрузка…
Ссылка в новой задаче