diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2018-05-31 22:03:59 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2018-05-31 22:03:59 +0200 |
commit | ce44a54179768c8e3f0675e8ce3a8d9bd5e9f12e (patch) | |
tree | 2f872165e4d9f70602269b82a7f6bf481f15a1df /node-repository | |
parent | 23e50026bbf6eaf37636ea8d5a0f911d6808b078 (diff) |
Throw IllegalStateException instead of returning null.
Diffstat (limited to 'node-repository')
-rw-r--r-- | node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/CuratorDatabase.java | 7 |
1 files changed, 6 insertions, 1 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 d583cd349b5..203f52a7b70 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 @@ -106,7 +106,12 @@ public class CuratorDatabase { return generation != cache.generation(); } public CuratorDatabaseCache validCache() { - return !expired() ? cache : null; + if (expired()) { + throw new IllegalStateException("The cache has generation " + cache.generation() + + " while the root genration counter in zookeeper says " + generation + + ". That is totally unacceptable and must be a sever programming error in my close vicinity."); + } + return cache; } private CuratorDatabaseCache cache; |