public void createLocalSessionFromDistributedApplicationPackage(long sessionId) {
        if (applicationRepo.sessionExistsInFileSystem(sessionId)) {
            log.log(Level.FINE, () -> "Local session for session id " + sessionId + " already exists");
            createSessionFromId(sessionId);
            return;
        }

        SessionZooKeeperClient sessionZKClient = createSessionZooKeeperClient(sessionId);
        var fileReference = sessionZKClient.readApplicationPackageReference();
        log.log(Level.FINE, () -> "File reference for session id " + sessionId + ": " + fileReference);
        if (fileReference.isEmpty()) return;

        Optional<File> sessionDir = fileDistributionFactory.fileDirectory().getFile(fileReference.get());
        // We cannot be guaranteed that the file reference exists (it could be that it has not
        // been downloaded yet), and e.g. when bootstrapping we cannot throw an exception in that case
        if (sessionDir.isEmpty()) return;

        ApplicationId applicationId = sessionZKClient.readApplicationId();
        log.log(Level.FINE, () -> "Creating local session for tenant '" + tenantName + "' with session id " + sessionId);
        createLocalSession(sessionDir.get(), applicationId, sessionId);
    }
Create a new local session for the given session id if it does not already exist and
will add the session to the local session cache. If there is no remote session matching
the session id the remote session will also be created.
configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java