aboutsummaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2020-08-03 11:33:34 +0200
committerHarald Musum <musum@verizonmedia.com>2020-08-03 11:33:34 +0200
commit06ab3ab5d80a0969a4ca937567a29cdad6daf3c0 (patch)
tree893dea0b7ec4fda086b1692a1f94856273444c75 /configserver
parentf73818637fc5f0c3dddc1cedacf259c5b3d4ef4a (diff)
Move call to add session into SessionRepository
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java3
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java6
2 files changed, 4 insertions, 5 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 58b7d0ec5bb..d040827ad2d 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
@@ -316,7 +316,6 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye
TimeoutBudget timeoutBudget = new TimeoutBudget(clock, timeout);
SessionRepository sessionRepository = tenant.getSessionRepository();
LocalSession newSession = sessionRepository.createSessionFromExisting(activeSession, logger, true, timeoutBudget);
- sessionRepository.addLocalSession(newSession);
return Optional.of(Deployment.unprepared(newSession, this, hostProvisioner, tenant, timeout, clock,
false /* don't validate as this is already deployed */, bootstrap));
@@ -653,7 +652,6 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye
SessionRepository sessionRepository = tenant.getSessionRepository();
RemoteSession fromSession = getExistingSession(tenant, applicationId);
LocalSession session = sessionRepository.createSessionFromExisting(fromSession, logger, internalRedeploy, timeoutBudget);
- sessionRepository.addLocalSession(session);
return session.getSessionId();
}
@@ -676,7 +674,6 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye
applicationId,
timeoutBudget,
activeSessionId);
- tenant.getSessionRepository().addLocalSession(session);
return session.getSessionId();
}
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java
index 9b337c97d88..aec9c7543a2 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java
@@ -121,7 +121,7 @@ public class SessionRepository {
// ---------------- Local sessions ----------------------------------------------------------------
- public synchronized void addLocalSession(LocalSession session) {
+ private synchronized void addLocalSession(LocalSession session) {
localSessionCache.addSession(session);
long sessionId = session.getSessionId();
RemoteSession remoteSession = createRemoteSession(sessionId);
@@ -262,7 +262,7 @@ public class SessionRepository {
return getSessionList(curator.getChildren(sessionsPath));
}
- public void addRemoteSession(RemoteSession session) {
+ private void addRemoteSession(RemoteSession session) {
remoteSessionCache.addSession(session);
metrics.incAddedSessions();
}
@@ -487,6 +487,7 @@ public class SessionRepository {
sessionZKClient.createNewSession(clock.instant());
Curator.CompletionWaiter waiter = sessionZKClient.getUploadWaiter();
LocalSession session = new LocalSession(tenantName, sessionId, applicationPackage, sessionZKClient, applicationRepo);
+ addLocalSession(session);
waiter.awaitCompletion(timeoutBudget.timeLeft());
return session;
}
@@ -518,6 +519,7 @@ public class SessionRepository {
session.setVespaVersion(existingSession.getVespaVersion());
session.setDockerImageRepository(existingSession.getDockerImageRepository());
session.setAthenzDomain(existingSession.getAthenzDomain());
+ addLocalSession(session);
return session;
}