aboutsummaryrefslogtreecommitdiffstats
path: root/standalone-container
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2022-02-07 14:52:49 +0100
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2022-02-07 14:52:49 +0100
commit5732785a8c5612c46c20c4c24d1f375ebb3e2e7f (patch)
treea81c8c3c83e243ba98031e0508e37564725ef3d4 /standalone-container
parent3d13b2df6632929fba8fa63fd3a712190898d5cd (diff)
Reapply "Shutdown reconfiguration thread in a more controlled way [run-systemtest]""
Diffstat (limited to 'standalone-container')
-rw-r--r--standalone-container/src/main/java/com/yahoo/container/standalone/StandaloneSubscriberFactory.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/standalone-container/src/main/java/com/yahoo/container/standalone/StandaloneSubscriberFactory.java b/standalone-container/src/main/java/com/yahoo/container/standalone/StandaloneSubscriberFactory.java
index 11f799fcfd4..907c9649912 100644
--- a/standalone-container/src/main/java/com/yahoo/container/standalone/StandaloneSubscriberFactory.java
+++ b/standalone-container/src/main/java/com/yahoo/container/standalone/StandaloneSubscriberFactory.java
@@ -31,6 +31,7 @@ public class StandaloneSubscriberFactory implements SubscriberFactory {
private final Set<ConfigKey<ConfigInstance>> configKeys;
private long generation = -1L;
+ private volatile boolean shutdown = false;
StandaloneSubscriber(Set<ConfigKey<ConfigInstance>> configKeys) {
this.configKeys = configKeys;
@@ -41,9 +42,7 @@ public class StandaloneSubscriberFactory implements SubscriberFactory {
return generation == 0;
}
- @Override
- public void close() {
- }
+ @Override public void close() { shutdown = true; }
@Override
public Map<ConfigKey<ConfigInstance>, ConfigInstance> config() {
@@ -64,9 +63,11 @@ public class StandaloneSubscriberFactory implements SubscriberFactory {
if (generation != 0) {
try {
- while (!Thread.interrupted()) {
- Thread.sleep(10000);
+ while (!shutdown && !Thread.interrupted()) {
+ Thread.sleep(100);
}
+ if (shutdown) // Same semantics as an actual interrupt
+ throw new ConfigInterruptedException(new InterruptedException());
} catch (InterruptedException e) {
throw new ConfigInterruptedException(e);
}