diff options
Diffstat (limited to 'container-core')
-rw-r--r-- | container-core/src/main/java/com/yahoo/container/handler/VipStatus.java | 18 | ||||
-rw-r--r-- | container-core/src/main/resources/configdefinitions/vip-status.def | 7 |
2 files changed, 18 insertions, 7 deletions
diff --git a/container-core/src/main/java/com/yahoo/container/handler/VipStatus.java b/container-core/src/main/java/com/yahoo/container/handler/VipStatus.java index bcd6e930ee3..d7457140dae 100644 --- a/container-core/src/main/java/com/yahoo/container/handler/VipStatus.java +++ b/container-core/src/main/java/com/yahoo/container/handler/VipStatus.java @@ -6,6 +6,7 @@ import java.util.Map; import com.google.inject.Inject; import com.yahoo.container.QrSearchersConfig; +import com.yahoo.container.core.VipStatusConfig; /** * API for programmatically removing the container from VIP rotation. @@ -15,15 +16,22 @@ import com.yahoo.container.QrSearchersConfig; public class VipStatus { private final Map<Object, Boolean> clusters = new IdentityHashMap<>(); + private final VipStatusConfig vipStatusConfig; public VipStatus() { - this(null); + this(null, new VipStatusConfig(new VipStatusConfig.Builder())); } - @Inject public VipStatus(QrSearchersConfig dispatchers) { + this(dispatchers, new VipStatusConfig(new VipStatusConfig.Builder())); + } + + // TODO: Why use QrSearchersConfig here? Remove and inject ComponentRegistry<ClusterSearcher> instead? + @Inject + public VipStatus(QrSearchersConfig dispatchers, VipStatusConfig vipStatusConfig) { // the config is not used for anything, it's just a dummy to create a // dependency link to which dispatchers are used + this.vipStatusConfig = vipStatusConfig; } /** @@ -55,14 +63,14 @@ public class VipStatus { /** * Tell whether the container is connected to any active services at all. * - * @return true if at least one service or cluster is up, or if no services + * @return true if at least one service or cluster is up, or value is taken from config if no services * are registered (yet) */ public boolean isInRotation() { synchronized (clusters) { - // if no stored state, try serving + // if no stored state, use config to decide whether to serve or not if (clusters.size() == 0) { - return true; + return vipStatusConfig.initiallyInRotation(); } for (Boolean inRotation : clusters.values()) { if (inRotation) { diff --git a/container-core/src/main/resources/configdefinitions/vip-status.def b/container-core/src/main/resources/configdefinitions/vip-status.def index 44da7292f05..1e364419ab8 100644 --- a/container-core/src/main/resources/configdefinitions/vip-status.def +++ b/container-core/src/main/resources/configdefinitions/vip-status.def @@ -6,9 +6,12 @@ namespace=container.core ## rotation, ignoring any status file. noSearchBackendsImpliesOutOfService bool default=true -## Whether to return hard coded reply or serve "status.html" from disk +## Whether to return hard-coded reply or serve "status.html" from disk accessdisk bool default=false ## The file to serve as the status file. -## If the paht is relative vespa home is prepended +## If the path is relative vespa home is prepended statusfile string default="share/qrsdocs/status.html" + +## The initial rotation state when no information is known about backend clusters +initiallyInRotation bool default=true |