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
This commit is contained in:
David Aurelio 2018-01-31 02:52:16 -08:00 committed by Facebook Github Bot
parent 00099093dc
commit e756251413

View File

@ -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()));