diff options
Diffstat (limited to 'node-repository')
-rw-r--r-- | node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/CuratorDatabase.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/CuratorDatabase.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/CuratorDatabase.java index e8fb9781dcd..2ceffc54dd5 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/CuratorDatabase.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/CuratorDatabase.java @@ -116,11 +116,12 @@ public class CuratorDatabase { /** Invalidates the current cache if outdated. */ private CuratorDatabaseCache getCache() { - long generation = changeGenerationCounter.get(); - synchronized (cacheCreationLock) { - if (generation != cache.get().generation) - cache.set(newCache(generation)); - } + if (changeGenerationCounter.get() != cache.get().generation) + synchronized (cacheCreationLock) { + while (changeGenerationCounter.get() != cache.get().generation) + cache.set(newCache(changeGenerationCounter.get())); + } + return cache.get(); } |