summaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorHarald Musum <musum@yahooinc.com>2023-01-24 08:24:32 +0100
committerHarald Musum <musum@yahooinc.com>2023-01-24 08:24:32 +0100
commit19a63e3ed5e14a329aa8c7c8e240c68d2263e56c (patch)
tree30b7622c5aa66ba457fb49acc39081ccc394d5c1 /configserver
parent58d182f429338805cfad65528445e43c2f25c2aa (diff)
Synchronize when adding blob as well
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDBRegistry.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDBRegistry.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDBRegistry.java
index 9d915650c73..6ea05d951f7 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDBRegistry.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDBRegistry.java
@@ -8,7 +8,6 @@ import com.yahoo.net.HostName;
import com.yahoo.path.Path;
import com.yahoo.text.Utf8;
import net.jpountz.xxhash.XXHashFactory;
-
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -105,7 +104,7 @@ public class FileDBRegistry implements FileRegistry {
}
@Override
- public FileReference addBlob(String blobName, ByteBuffer blob) {
+ public synchronized FileReference addBlob(String blobName, ByteBuffer blob) {
String relativePath = blobToRelativeFile(blobName);
synchronized (this) {
Optional<FileReference> cachedReference = Optional.ofNullable(fileReferenceCache.get(blobName));
@@ -126,6 +125,7 @@ public class FileDBRegistry implements FileRegistry {
return entries;
}
+ // Used for testing only
synchronized Map<String, FileReference> getMap() {
return ImmutableMap.copyOf(fileReferenceCache);
}