mirror of
https://github.com/status-im/react-native.git
synced 2025-01-28 18:25:06 +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,12 +91,16 @@ public class UnpackingJSBundleLoader extends JSBundleLoader {
|
||||
|
||||
final File lockFilePath = new File(mContext.getFilesDir(), LOCK_FILE);
|
||||
Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "UnpackingJSBundleLoader.prepare");
|
||||
try (FileLocker lock = FileLocker.lock(lockFilePath)) {
|
||||
unpacked = prepareLocked();
|
||||
} catch (IOException ioe) {
|
||||
throw new RuntimeException(ioe);
|
||||
} finally {
|
||||
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||
|
||||
// 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) {
|
||||
throw new RuntimeException(ioe);
|
||||
} finally {
|
||||
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||
}
|
||||
}
|
||||
|
||||
if (unpacked && mOnUnpackedCallback != null) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user