diff options
author | Jon Bratseth <bratseth@oath.com> | 2018-07-23 14:03:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-23 14:03:00 +0200 |
commit | c22ac79cf445a1917f2e484cc41d8508dbc776bc (patch) | |
tree | 13297e297eed6cccc2ca85e145cb9dba81c091e1 /container-di/src/main/java/com | |
parent | ce4798777d1991beb72c3df2e54352db3eb1a4ee (diff) | |
parent | 36805c46674077714af3e076d2a35868534c5b04 (diff) |
Merge pull request #6444 from vespa-engine/bratseth/java-model-inference
Bratseth/java model inference
Diffstat (limited to 'container-di/src/main/java/com')
-rw-r--r-- | container-di/src/main/java/com/yahoo/container/di/ConfigRetriever.java | 20 | ||||
-rw-r--r-- | container-di/src/main/java/com/yahoo/container/di/Container.java | 9 |
2 files changed, 14 insertions, 15 deletions
diff --git a/container-di/src/main/java/com/yahoo/container/di/ConfigRetriever.java b/container-di/src/main/java/com/yahoo/container/di/ConfigRetriever.java index fe315c0eba5..337997f8ac2 100644 --- a/container-di/src/main/java/com/yahoo/container/di/ConfigRetriever.java +++ b/container-di/src/main/java/com/yahoo/container/di/ConfigRetriever.java @@ -47,13 +47,14 @@ public final class ConfigRetriever { /** * Loop forever until we get config */ - public ConfigSnapshot getConfigs(Set<ConfigKey<? extends ConfigInstance>> componentConfigKeys, long leastGeneration, - boolean restartOnRedeploy) { + public ConfigSnapshot getConfigs(Set<ConfigKey<? extends ConfigInstance>> componentConfigKeys, + long leastGeneration, + boolean restartOnRedeploy) { while (true) { - if (!Sets.intersection(componentConfigKeys, bootstrapKeys).isEmpty()) { - throw new IllegalArgumentException( - "Component config keys [" + componentConfigKeys + "] overlaps with bootstrap config keys [" + bootstrapKeys + "]"); - } + if (!Sets.intersection(componentConfigKeys, bootstrapKeys).isEmpty()) + throw new IllegalArgumentException("Component config keys [" + componentConfigKeys + + "] overlaps with bootstrap config keys [" + bootstrapKeys + "]"); + log.log(DEBUG, "getConfigs: " + componentConfigKeys); Set<ConfigKey<? extends ConfigInstance>> allKeys = new HashSet<>(componentConfigKeys); allKeys.addAll(bootstrapKeys); @@ -75,8 +76,9 @@ public final class ConfigRetriever { /** * Try to get config just once */ - public Optional<ConfigSnapshot> getConfigsOnce(Set<ConfigKey<? extends ConfigInstance>> componentConfigKeys, long leastGeneration, - boolean restartOnRedeploy) { + Optional<ConfigSnapshot> getConfigsOnce(Set<ConfigKey<? extends ConfigInstance>> componentConfigKeys, + long leastGeneration, + boolean restartOnRedeploy) { if (!Sets.intersection(componentConfigKeys, bootstrapKeys).isEmpty()) { throw new IllegalArgumentException( "Component config keys [" + componentConfigKeys + "] overlaps with bootstrap config keys [" + bootstrapKeys + "]"); @@ -114,7 +116,7 @@ public final class ConfigRetriever { } else { // This should not be a normal case, and hence a warning to allow investigation. log.warning("Did not get same generation for bootstrap (" + newestBootstrapGeneration + ") and components configs (" - + newestComponentGeneration + ")."); + + newestComponentGeneration + ")."); return Optional.empty(); } } diff --git a/container-di/src/main/java/com/yahoo/container/di/Container.java b/container-di/src/main/java/com/yahoo/container/di/Container.java index 7c58120d858..fb427bcf8ae 100644 --- a/container-di/src/main/java/com/yahoo/container/di/Container.java +++ b/container-di/src/main/java/com/yahoo/container/di/Container.java @@ -73,7 +73,6 @@ public class Container { } public ComponentGraph getNewComponentGraph(ComponentGraph oldGraph, Injector fallbackInjector, boolean restartOnRedeploy) { - try { ComponentGraph newGraph = getConfigAndCreateGraph(oldGraph, fallbackInjector, restartOnRedeploy); newGraph.reuseNodes(oldGraph); @@ -87,11 +86,11 @@ public class Container { } } - public ComponentGraph getNewComponentGraph(ComponentGraph oldGraph) { + ComponentGraph getNewComponentGraph(ComponentGraph oldGraph) { return getNewComponentGraph(oldGraph, Guice.createInjector(), false); } - public ComponentGraph getNewComponentGraph() { + ComponentGraph getNewComponentGraph() { return getNewComponentGraph(new ComponentGraph(), Guice.createInjector(), false); } @@ -125,10 +124,8 @@ public class Container { } } - public ComponentGraph getConfigAndCreateGraph(ComponentGraph graph, Injector fallbackInjector, boolean restartOnRedeploy) { - + private ComponentGraph getConfigAndCreateGraph(ComponentGraph graph, Injector fallbackInjector, boolean restartOnRedeploy) { ConfigSnapshot snapshot; - while (true) { snapshot = configurer.getConfigs(graph.configKeys(), leastGeneration, restartOnRedeploy); |