Synchronize AccountLoader#get and #put
These methods are called from ChangeJson which runs formatting in parallel. Since these methods modify local variables that are not thread-safe, they need to be synchronized. Both methods modify distinct variables so that an overall synchronization is not required. Change-Id: I328dc1265c3329f2c7ad66fb5946f30ca4e5f3b8
This commit is contained in:
@@ -69,7 +69,7 @@ public class AccountLoader {
|
||||
provided = new ArrayList<>();
|
||||
}
|
||||
|
||||
public AccountInfo get(Account.Id id) {
|
||||
public synchronized AccountInfo get(Account.Id id) {
|
||||
if (id == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public class AccountLoader {
|
||||
return info;
|
||||
}
|
||||
|
||||
public void put(AccountInfo info) {
|
||||
public synchronized void put(AccountInfo info) {
|
||||
checkArgument(info._accountId != null, "_accountId field required");
|
||||
provided.add(info);
|
||||
}
|
||||
|
Reference in New Issue
Block a user