summaryrefslogtreecommitdiffstats
path: root/container-core
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2021-04-28 15:56:45 +0200
committerJon Marius Venstad <venstad@gmail.com>2021-04-28 15:56:45 +0200
commit5d2c85de4e5e5f9182189cb2aaf9369070f41533 (patch)
tree306f65d364d04f5c23e41b8cdc3d3c90c7162342 /container-core
parent4fbd27dddde4aff5de1be48f79057b6357bed123 (diff)
More lazy debug log message generation
Diffstat (limited to 'container-core')
-rw-r--r--container-core/src/main/java/com/yahoo/container/core/config/HandlersConfigurerDi.java2
-rw-r--r--container-core/src/main/java/com/yahoo/container/di/ConfigRetriever.java10
-rw-r--r--container-core/src/main/java/com/yahoo/container/di/Container.java9
-rw-r--r--container-core/src/main/java/com/yahoo/container/di/componentgraph/cycle/CycleFinder.java6
4 files changed, 14 insertions, 13 deletions
diff --git a/container-core/src/main/java/com/yahoo/container/core/config/HandlersConfigurerDi.java b/container-core/src/main/java/com/yahoo/container/core/config/HandlersConfigurerDi.java
index 236602b7767..9f6f5cf7ea1 100644
--- a/container-core/src/main/java/com/yahoo/container/core/config/HandlersConfigurerDi.java
+++ b/container-core/src/main/java/com/yahoo/container/core/config/HandlersConfigurerDi.java
@@ -176,7 +176,7 @@ public class HandlersConfigurerDi {
ComponentRegistry<RequestHandler> requestHandlerRegistry,
ComponentRegistry<ClientProvider> clientProviderRegistry,
ComponentRegistry<ServerProvider> serverProviderRegistry) {
- log.log(Level.FINE, "RegistriesHack.init " + System.identityHashCode(this));
+ log.log(Level.FINE, () -> "RegistriesHack.init " + System.identityHashCode(this));
vespaContainer.setComponentRegistry(allComponents);
vespaContainer.setRequestHandlerRegistry(requestHandlerRegistry);
diff --git a/container-core/src/main/java/com/yahoo/container/di/ConfigRetriever.java b/container-core/src/main/java/com/yahoo/container/di/ConfigRetriever.java
index a7ff6c46a8b..33771bd0c1e 100644
--- a/container-core/src/main/java/com/yahoo/container/di/ConfigRetriever.java
+++ b/container-core/src/main/java/com/yahoo/container/di/ConfigRetriever.java
@@ -64,7 +64,7 @@ public final class ConfigRetriever {
throw new IllegalArgumentException(
"Component config keys [" + componentConfigKeys + "] overlaps with bootstrap config keys [" + bootstrapKeys + "]");
}
- log.log(FINE, "getConfigsOnce: " + componentConfigKeys);
+ log.log(FINE, () -> "getConfigsOnce: " + componentConfigKeys);
Set<ConfigKey<? extends ConfigInstance>> allKeys = new HashSet<>(componentConfigKeys);
allKeys.addAll(bootstrapKeys);
@@ -75,20 +75,20 @@ public final class ConfigRetriever {
private Optional<ConfigSnapshot> getConfigsOptional(long leastGeneration, boolean isInitializing) {
long newestComponentGeneration = componentSubscriber.waitNextGeneration(isInitializing);
- log.log(FINE, "getConfigsOptional: new component generation: " + newestComponentGeneration);
+ log.log(FINE, () -> "getConfigsOptional: new component generation: " + newestComponentGeneration);
// leastGeneration is only used to ensure newer generation when the previous generation was invalidated due to an exception
if (newestComponentGeneration < leastGeneration) {
return Optional.empty();
} else if (bootstrapSubscriber.generation() < newestComponentGeneration) {
long newestBootstrapGeneration = bootstrapSubscriber.waitNextGeneration(isInitializing);
- log.log(FINE, "getConfigsOptional: new bootstrap generation: " + bootstrapSubscriber.generation());
+ log.log(FINE, () -> "getConfigsOptional: new bootstrap generation: " + bootstrapSubscriber.generation());
Optional<ConfigSnapshot> bootstrapConfig = bootstrapConfigIfChanged();
if (bootstrapConfig.isPresent()) {
return bootstrapConfig;
} else {
if (newestBootstrapGeneration == newestComponentGeneration) {
- log.log(FINE, "Got new components configs with unchanged bootstrap configs.");
+ log.log(FINE, () -> "Got new components configs with unchanged bootstrap configs.");
return componentsConfigIfChanged();
} else {
// This should not be a normal case, and hence a warning to allow investigation.
@@ -131,7 +131,7 @@ public final class ConfigRetriever {
componentSubscriber.close();
componentSubscriberKeys = keys;
try {
- log.log(FINE, "Setting up new component subscriber for keys: " + keys);
+ log.log(FINE, () -> "Setting up new component subscriber for keys: " + keys);
componentSubscriber = subscribe.apply(keys);
} catch (Throwable e) {
log.log(Level.WARNING, "Failed setting up subscriptions for component configs: " + e.getMessage());
diff --git a/container-core/src/main/java/com/yahoo/container/di/Container.java b/container-core/src/main/java/com/yahoo/container/di/Container.java
index 82c7f65bc2a..a91aa6eb588 100644
--- a/container-core/src/main/java/com/yahoo/container/di/Container.java
+++ b/container-core/src/main/java/com/yahoo/container/di/Container.java
@@ -95,8 +95,9 @@ public class Container {
while (true) {
snapshot = configurer.getConfigs(graph.configKeys(), leastGeneration, isInitializing);
- log.log(FINE, String.format("createNewGraph:\n" + "graph.configKeys = %s\n" + "graph.generation = %s\n" + "snapshot = %s\n",
- graph.configKeys(), graph.generation(), snapshot));
+ if (log.isLoggable(FINE))
+ log.log(FINE, String.format("createNewGraph:\n" + "graph.configKeys = %s\n" + "graph.generation = %s\n" + "snapshot = %s\n",
+ graph.configKeys(), graph.generation(), snapshot));
if (snapshot instanceof BootstrapConfigs) {
if (getBootstrapGeneration() <= previousConfigGeneration) {
@@ -104,7 +105,7 @@ public class Container {
"Got bootstrap configs out of sequence for old config generation %d.\n" + "Previous config generation is %d",
getBootstrapGeneration(), previousConfigGeneration));
}
- log.log(FINE, "Got new bootstrap generation\n" + configGenerationsString());
+ log.log(FINE, () -> "Got new bootstrap generation\n" + configGenerationsString());
if (graph.generation() == 0) {
platformBundles = getConfig(platformBundlesConfigKey, snapshot.configs()).bundlePaths();
@@ -123,7 +124,7 @@ public class Container {
break;
}
}
- log.log(FINE, "Got components configs,\n" + configGenerationsString());
+ log.log(FINE, () -> "Got components configs,\n" + configGenerationsString());
return createAndConfigureComponentsGraph(snapshot.configs(), fallbackInjector);
}
diff --git a/container-core/src/main/java/com/yahoo/container/di/componentgraph/cycle/CycleFinder.java b/container-core/src/main/java/com/yahoo/container/di/componentgraph/cycle/CycleFinder.java
index 327949bb8d0..3aa8ae56817 100644
--- a/container-core/src/main/java/com/yahoo/container/di/componentgraph/cycle/CycleFinder.java
+++ b/container-core/src/main/java/com/yahoo/container/di/componentgraph/cycle/CycleFinder.java
@@ -58,7 +58,7 @@ public class CycleFinder<T> {
if (visitDepthFirst(vertex, new ArrayList<>(singletonList(vertex)))) {
if (cycle == null) throw new IllegalStateException("Null cycle - this should never happen");
if (cycle.isEmpty()) throw new IllegalStateException("Empty cycle - this should never happen");
- log.log(FINE, "Cycle detected: " + cycle);
+ log.log(FINE, () -> "Cycle detected: " + cycle);
return cycle;
}
}
@@ -68,7 +68,7 @@ public class CycleFinder<T> {
private boolean visitDepthFirst(T vertex, List<T> path) {
colors.put(vertex, GRAY);
- log.log(FINE, "Vertex start " + vertex + " - colors: " + colors + " - path: " + path);
+ log.log(FINE, () -> "Vertex start " + vertex + " - colors: " + colors + " - path: " + path);
for (T adjacent : graph.getAdjacent(vertex)) {
path.add(adjacent);
if (colors.get(adjacent) == GRAY) {
@@ -81,7 +81,7 @@ public class CycleFinder<T> {
path.remove(adjacent);
}
colors.put(vertex, BLACK);
- log.log(FINE, "Vertex end " + vertex + " - colors: " + colors + " - path: " + path);
+ log.log(FINE, () -> "Vertex end " + vertex + " - colors: " + colors + " - path: " + path);
return false;
}