summaryrefslogtreecommitdiffstats
path: root/container-di/src
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2018-06-28 20:32:35 +0200
committerJon Bratseth <bratseth@oath.com>2018-06-28 20:32:35 +0200
commitc54157061aba2730cbaa428d2b5b80001efa4a25 (patch)
tree2bd3f0d3a917ebf16d81b8562c7926f34028afef /container-di/src
parentfe34fc0746fc5fb9a131d83595fd48ba5b1f680c (diff)
Model inference initial commit
Diffstat (limited to 'container-di/src')
-rw-r--r--container-di/src/main/java/com/yahoo/container/di/ConfigRetriever.java20
-rw-r--r--container-di/src/main/java/com/yahoo/container/di/Container.java9
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);