diff options
-rw-r--r-- | configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java | 13 |
1 files changed, 8 insertions, 5 deletions
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 8979176b66c..492c9432646 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 @@ -325,13 +325,15 @@ public class SessionRepository { loadSessionIfActive(remoteSession); addRemoteSession(remoteSession); Optional<LocalSession> localSession = Optional.empty(); - if (distributeApplicationPackage.value()) { + if (distributeApplicationPackage()) localSession = createLocalSessionUsingDistributedApplicationPackage(sessionId); - localSession.ifPresent(this::addSession); - } addWatcher(sessionId, fileCache, remoteSession, localSession); } + private boolean distributeApplicationPackage() { + return distributeApplicationPackage.value(); + } + private void sessionRemoved(long sessionId) { SessionStateWatcher watcher = sessionStateWatchers.remove(sessionId); if (watcher != null) watcher.close(); @@ -464,7 +466,7 @@ public class SessionRepository { LocalSession session = create(existingApp, existingApplicationId, activeSessionId, internalRedeploy, timeoutBudget); // Note: Needs to be kept in sync with calls in SessionPreparer.writeStateToZooKeeper() session.setApplicationId(existingApplicationId); - if (distributeApplicationPackage.value() && existingSession.getApplicationPackageReference() != null) { + if (distributeApplicationPackage() && existingSession.getApplicationPackageReference() != null) { session.setApplicationPackageReference(existingSession.getApplicationPackageReference()); } session.setVespaVersion(existingSession.getVespaVersion()); @@ -542,7 +544,8 @@ public class SessionRepository { } /** - * Returns a new session instance for the given session id. + * Returns a new local session for the given session id if it does not already exist. + * Will also add the session to the local session cache if necessary */ public Optional<LocalSession> createLocalSessionUsingDistributedApplicationPackage(long sessionId) { if (applicationRepo.hasLocalSession(sessionId)) { |