mirror of
https://github.com/status-im/react-native.git
synced 2025-02-11 00:46:32 +00:00
Synchronize before acquiring file lock
Reviewed By: dcaspi Differential Revision: D4071662 fbshipit-source-id: 3458ff103fddb82a7588d7890f8bc931c0e19e14
This commit is contained in:
parent
5f15554100
commit
cfebad97b2
@ -91,6 +91,9 @@ public class UnpackingJSBundleLoader extends JSBundleLoader {
|
|||||||
|
|
||||||
final File lockFilePath = new File(mContext.getFilesDir(), LOCK_FILE);
|
final File lockFilePath = new File(mContext.getFilesDir(), LOCK_FILE);
|
||||||
Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "UnpackingJSBundleLoader.prepare");
|
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)) {
|
try (FileLocker lock = FileLocker.lock(lockFilePath)) {
|
||||||
unpacked = prepareLocked();
|
unpacked = prepareLocked();
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
@ -98,6 +101,7 @@ public class UnpackingJSBundleLoader extends JSBundleLoader {
|
|||||||
} finally {
|
} finally {
|
||||||
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
|
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (unpacked && mOnUnpackedCallback != null) {
|
if (unpacked && mOnUnpackedCallback != null) {
|
||||||
mOnUnpackedCallback.run();
|
mOnUnpackedCallback.run();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user