diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2022-02-07 15:55:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-07 15:55:47 +0100 |
commit | c9c4f38561d990049f9a15b0d8a244e7a727efa9 (patch) | |
tree | d45bee0093ad94a97c40cdb02c62606d812cdaa2 /config | |
parent | 0d605a9e1cad55fc3e8f1830cc3a6f0d70d289d6 (diff) | |
parent | 3144aec4cff50f200115c8ed06fa34594e7f3026 (diff) |
Merge pull request #21093 from vespa-engine/bjorncs/dont-use-interrupts
Bjorncs/dont use interrupts [run-systemtest]
Diffstat (limited to 'config')
3 files changed, 27 insertions, 1 deletions
diff --git a/config/abi-spec.json b/config/abi-spec.json index 844835ae1c5..e94749cfba8 100644 --- a/config/abi-spec.json +++ b/config/abi-spec.json @@ -297,5 +297,16 @@ "fields": [ "public final java.lang.String payload" ] + }, + "com.yahoo.config.subscription.SubscriberClosedException": { + "superClass": "java.lang.RuntimeException", + "interfaces": [], + "attributes": [ + "public" + ], + "methods": [ + "public void <init>()" + ], + "fields": [] } }
\ No newline at end of file diff --git a/config/src/main/java/com/yahoo/config/subscription/ConfigSubscriber.java b/config/src/main/java/com/yahoo/config/subscription/ConfigSubscriber.java index de5eeb5649c..a89d60108ac 100644 --- a/config/src/main/java/com/yahoo/config/subscription/ConfigSubscriber.java +++ b/config/src/main/java/com/yahoo/config/subscription/ConfigSubscriber.java @@ -156,6 +156,7 @@ public class ConfigSubscriber implements AutoCloseable { * false if this is for reconfiguration * @return true if a config/reconfig of your system should happen * @throws ConfigInterruptedException if thread performing this call interrupted. + * @throws SubscriberClosedException if subscriber is closed */ public boolean nextConfig(boolean isInitializing) { return nextConfig(TimingValues.defaultNextConfigTimeout, isInitializing); @@ -187,6 +188,7 @@ public class ConfigSubscriber implements AutoCloseable { * false if this is for reconfiguration * @return true if a config/reconfig of your system should happen * @throws ConfigInterruptedException if thread performing this call interrupted. + * @throws SubscriberClosedException if subscriber is closed */ public boolean nextConfig(long timeoutMillis, boolean isInitializing) { return acquireSnapshot(timeoutMillis, true, isInitializing); @@ -218,6 +220,7 @@ public class ConfigSubscriber implements AutoCloseable { * false if this is for reconfiguration * @return true if generations for all configs have been updated. * @throws ConfigInterruptedException if thread performing this call interrupted. + * @throws SubscriberClosedException if subscriber is closed */ public boolean nextGeneration(boolean isInitializing) { return nextGeneration(TimingValues.defaultNextConfigTimeout, isInitializing); @@ -249,6 +252,7 @@ public class ConfigSubscriber implements AutoCloseable { * false if this is for reconfiguration * @return true if generations for all configs have been updated. * @throws ConfigInterruptedException if thread performing this call interrupted. + * @throws SubscriberClosedException if subscriber is closed */ public boolean nextGeneration(long timeoutMillis, boolean isInitializing) { return acquireSnapshot(timeoutMillis, false, isInitializing); @@ -271,7 +275,7 @@ public class ConfigSubscriber implements AutoCloseable { private boolean acquireSnapshot(long timeoutInMillis, boolean requireChange, boolean isInitializing) { boolean applyOnRestartOnly; synchronized (monitor) { - if (state == State.CLOSED) return false; + if (state == State.CLOSED) throw new SubscriberClosedException(); state = State.FROZEN; applyOnRestartOnly = applyOnRestart; } diff --git a/config/src/main/java/com/yahoo/config/subscription/SubscriberClosedException.java b/config/src/main/java/com/yahoo/config/subscription/SubscriberClosedException.java new file mode 100644 index 00000000000..f7051ab1b38 --- /dev/null +++ b/config/src/main/java/com/yahoo/config/subscription/SubscriberClosedException.java @@ -0,0 +1,11 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.config.subscription; + +/** + * Thrown when {@link ConfigSubscriber} is closed + * + * @author bjorncs + * @deprecated Will be removed in Vespa 8. Only for internal use. + */ +@Deprecated(forRemoval = true, since = "7") +public class SubscriberClosedException extends RuntimeException {} |