Session getSession() {
        if (changeGenerationCounter.get() != cache.get().generation)
            synchronized (cacheCreationLock) {
                while (changeGenerationCounter.get() != cache.get().generation)
                    cache.set(newCache(changeGenerationCounter.get()));
            }
            
        return cache.get();
    }
Invalidates the current cache if outdated.
node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/CachingCurator.java