aboutsummaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2021-02-10 17:39:25 +0100
committerHarald Musum <musum@verizonmedia.com>2021-02-10 17:39:25 +0100
commit775a55b86115203e06cee27972a402f80926f30e (patch)
tree57b1e10a82943ff5deab4000fcceab53bad54fbd /configserver
parentea87741d28b855e9882e64c083ca5db845bb603f (diff)
Use a unmodifiable collection to avoid possible concurrent modification
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java
index a72381d4e84..2374744a762 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java
@@ -90,6 +90,7 @@ import java.time.Clock;
import java.time.Duration;
import java.time.Instant;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -835,7 +836,9 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye
public void deleteExpiredLocalSessions() {
Map<Tenant, Collection<LocalSession>> sessionsPerTenant = new HashMap<>();
- tenantRepository.getAllTenants().forEach(tenant -> sessionsPerTenant.put(tenant, tenant.getSessionRepository().getLocalSessions()));
+ tenantRepository.getAllTenants()
+ .forEach(tenant -> sessionsPerTenant.put(tenant,
+ Collections.unmodifiableCollection(tenant.getSessionRepository().getLocalSessions())));
Set<ApplicationId> applicationIds = new HashSet<>();
sessionsPerTenant.values()