diff options
Diffstat (limited to 'container-core')
4 files changed, 21 insertions, 30 deletions
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 1baf217da6b..dbf2ba4a9a8 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 @@ -94,6 +94,14 @@ public class Container { } } + private void constructComponents(ComponentGraph graph) { + graph.nodes().forEach(n -> { + if (Thread.interrupted()) + throw new UncheckedInterruptedException("Interrupted while constructing component graph", true); + n.constructInstance(); + }); + } + private ComponentGraph waitForNewConfigGenAndCreateGraph( ComponentGraph graph, Injector fallbackInjector, boolean isInitializing, Collection<Bundle> obsoleteBundles) // NOTE: Return value { @@ -122,7 +130,7 @@ public class Container { Collection<Bundle> bundlesToRemove = installApplicationBundles(snapshot.configs()); obsoleteBundles.addAll(bundlesToRemove); - graph = createComponentsGraph(snapshot.configs(), getBootstrapGeneration(), fallbackInjector); + graph = createComponentGraph(snapshot.configs(), getBootstrapGeneration(), fallbackInjector); // Continues loop @@ -131,7 +139,7 @@ public class Container { } } log.log(FINE, () -> "Got components configs,\n" + configGenerationsString()); - return createAndConfigureComponentsGraph(snapshot.configs(), fallbackInjector); + return createAndConfigureComponentGraph(snapshot.configs(), fallbackInjector); } private long getBootstrapGeneration() { @@ -153,21 +161,13 @@ public class Container { throw new RuntimeException("Platform bundles are not allowed to change!\nOld: " + platformBundles + "\nNew: " + checkPlatformBundles); } - private ComponentGraph createAndConfigureComponentsGraph(Map<ConfigKey<? extends ConfigInstance>, ConfigInstance> componentsConfigs, - Injector fallbackInjector) { - ComponentGraph componentGraph = createComponentsGraph(componentsConfigs, getComponentsGeneration(), fallbackInjector); + private ComponentGraph createAndConfigureComponentGraph(Map<ConfigKey<? extends ConfigInstance>, ConfigInstance> componentsConfigs, + Injector fallbackInjector) { + ComponentGraph componentGraph = createComponentGraph(componentsConfigs, getComponentsGeneration(), fallbackInjector); componentGraph.setAvailableConfigs(componentsConfigs); return componentGraph; } - private void constructComponents(ComponentGraph graph) { - graph.nodes().forEach(n -> { - if (Thread.interrupted()) - throw new UncheckedInterruptedException("Interrupted while constructing component graph", true); - n.constructInstance(); - }); - } - private void deconstructFailedGraph(ComponentGraph currentGraph, ComponentGraph failedGraph) { Set<Object> currentComponents = Collections.newSetFromMap(new IdentityHashMap<>(currentGraph.size())); currentComponents.addAll(currentGraph.allConstructedComponentsAndProviders()); @@ -199,8 +199,8 @@ public class Container { return osgi.useApplicationBundles(applicationBundlesConfig.bundles()); } - private ComponentGraph createComponentsGraph(Map<ConfigKey<? extends ConfigInstance>, ConfigInstance> configsIncludingBootstrapConfigs, - long generation, Injector fallbackInjector) { + private ComponentGraph createComponentGraph(Map<ConfigKey<? extends ConfigInstance>, ConfigInstance> configsIncludingBootstrapConfigs, + long generation, Injector fallbackInjector) { previousConfigGeneration = generation; ComponentGraph graph = new ComponentGraph(generation); diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HealthCheckProxyHandler.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HealthCheckProxyHandler.java index 18490765576..ac50cbbb518 100644 --- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HealthCheckProxyHandler.java +++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HealthCheckProxyHandler.java @@ -91,8 +91,7 @@ class HealthCheckProxyHandler extends HandlerWrapper { .map(detectorConnFactory -> detectorConnFactory.getBean(SslConnectionFactory.class))) .map(connFactory -> (SslContextFactory.Server) connFactory.getSslContextFactory()) .orElseThrow(() -> new IllegalArgumentException("Health check proxy can only target https port")); - ConnectorConfig.ProxyProtocol proxyProtocolCfg = targetConnector.connectorConfig().proxyProtocol(); - boolean proxyProtocol = proxyProtocolCfg.enabled() && !proxyProtocolCfg.mixedMode(); + boolean proxyProtocol = targetConnector.connectorConfig().proxyProtocol().enabled(); return new ProxyTarget(targetPort, clientTimeout,handlerTimeout, cacheExpiry, sslContextFactory, proxyProtocol); } diff --git a/container-core/src/main/java/com/yahoo/processing/request/CloneHelper.java b/container-core/src/main/java/com/yahoo/processing/request/CloneHelper.java index 8ff54ab6728..64a356fbf2a 100644 --- a/container-core/src/main/java/com/yahoo/processing/request/CloneHelper.java +++ b/container-core/src/main/java/com/yahoo/processing/request/CloneHelper.java @@ -8,7 +8,6 @@ import com.yahoo.lang.PublicCloneable; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.HashSet; -import java.util.LinkedHashMap; import java.util.logging.Logger; import java.util.LinkedList; import java.util.ArrayList; @@ -35,9 +34,7 @@ public class CloneHelper { private static final Logger log = Logger.getLogger(CloneHelper.class.getName()); private static final MethodCache cloneMethodCache = new MethodCache("clone"); - /** - * Clones this object if it is clonable, and the clone is public. Returns null if not - */ + /** Clones this object if it is clonable, and the clone is public. Returns null if not. */ public final Object clone(Object object) { if (object == null) return null; if ( ! (object instanceof Cloneable)) return null; @@ -115,24 +112,22 @@ public class CloneHelper { Method cloneMethod = cloneMethodCache.get(object); if (cloneMethod == null) { log.warning("'" + object + "' of class " + object.getClass() + - " is Cloneable, but has no clone method - will use the same instance in all requests"); + " is Cloneable, but has no clone method - will use the same instance in all requests"); return null; } return cloneMethod.invoke(object); } catch (IllegalAccessException e) { log.warning("'" + object + "' of class " + object.getClass() + - " is Cloneable, but clone method cannot be accessed - will use the same instance in all requests"); + " is Cloneable, but clone method cannot be accessed - will use the same instance in all requests"); return null; } catch (InvocationTargetException e) { throw new RuntimeException("Exception cloning '" + object + "'", e); } } - /** - * Clones a map by deep cloning each value which is cloneable and shallow copying all other values. - */ + /** Clones a map by deep cloning each value which is cloneable and shallow copying all other values. */ public Map<CompoundName, Object> cloneMap(Map<CompoundName, Object> map) { - Map<CompoundName, Object> cloneMap = new HashMap<>(map.size()); + Map<CompoundName, Object> cloneMap = new HashMap<>((int)(map.size()/0.75) + 1); for (Map.Entry<CompoundName, Object> entry : map.entrySet()) { Object cloneValue = clone(entry.getValue()); if (cloneValue == null) diff --git a/container-core/src/main/java/com/yahoo/processing/request/properties/PropertyMap.java b/container-core/src/main/java/com/yahoo/processing/request/properties/PropertyMap.java index f149c177b47..adaac4216b9 100644 --- a/container-core/src/main/java/com/yahoo/processing/request/properties/PropertyMap.java +++ b/container-core/src/main/java/com/yahoo/processing/request/properties/PropertyMap.java @@ -22,9 +22,6 @@ import java.util.Map; */ public class PropertyMap extends Properties { - /** - * The properties of this - */ private Map<CompoundName, Object> properties = new HashMap<>(); public void set(CompoundName name, Object value, Map<String, String> context) { |