From e7562514130f614a9f138c0b855bfe4516150add Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Wed, 31 Jan 2018 02:52:16 -0800 Subject: [PATCH] Synchronize map access Summary: We want applying deltas to be an atomic operation, from incrementing the delta message ID to updating the relevant maps. This is a simple approach to synchronize the corrsponding method. We will probably need to go with a more sophisticated approach, that makes sure that deltas are applied in order. That would also allow us to lock only on writes. Reviewed By: kathryngray Differential Revision: D6846560 fbshipit-source-id: 175a80b4e39223883e397d75e20109fc12a2a878 --- .../java/com/facebook/react/devsupport/BundleDownloader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.java index a6aeb18f1..ad127b746 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.java @@ -286,7 +286,7 @@ public class BundleDownloader { return true; } - private boolean storeDeltaInFile(BufferedSource body, File outputFile) throws IOException { + private synchronized boolean storeDeltaInFile(BufferedSource body, File outputFile) throws IOException { JsonReader jsonReader = new JsonReader(new InputStreamReader(body.inputStream()));