Add missing synchronized keywords and assertions

applyContentMetadataMutations and getContentMetadata methods suppossed to be synchronized and assert the instance isn't released.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191419637
This commit is contained in:
eguven 2018-04-03 03:32:24 -07:00 committed by Oliver Woodman
parent 82c71378eb
commit f7e2cdbbbb

View file

@ -306,14 +306,16 @@ public final class SimpleCache implements Cache {
}
@Override
public void applyContentMetadataMutations(String key, ContentMetadataMutations mutations)
throws CacheException {
public synchronized void applyContentMetadataMutations(
String key, ContentMetadataMutations mutations) throws CacheException {
Assertions.checkState(!released);
index.applyContentMetadataMutations(key, mutations);
index.store();
}
@Override
public ContentMetadata getContentMetadata(String key) {
public synchronized ContentMetadata getContentMetadata(String key) {
Assertions.checkState(!released);
return index.getContentMetadata(key);
}