summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java
diff options
context:
space:
mode:
Diffstat (limited to 'config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java')
-rwxr-xr-xconfig-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java36
1 files changed, 23 insertions, 13 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java
index 2385b5b3812..e69872ca1e7 100755
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java
@@ -73,6 +73,8 @@ import java.util.TreeSet;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+import static com.yahoo.vespa.model.container.component.chain.ProcessingHandler.PROCESSING_HANDLER_CLASS;
+
/**
* Parent class for all container cluster types.
*
@@ -129,7 +131,7 @@ public abstract class ContainerCluster<CONTAINER extends Container>
public static final BindingPattern VIP_HANDLER_BINDING = SystemBindingPattern.fromHttpPath("/status.html");
public static final Set<Path> SEARCH_AND_DOCPROC_BUNDLES = Stream.of(
- PlatformBundles.searchAndDocprocBundle, "container-search-gui", "docprocs", "linguistics-components")
+ PlatformBundles.SEARCH_AND_DOCPROC_BUNDLE, "container-search-gui", "docprocs", "linguistics-components")
.map(PlatformBundles::absoluteBundlePath).collect(Collectors.toSet());
private final String name;
@@ -142,6 +144,7 @@ public abstract class ContainerCluster<CONTAINER extends Container>
private ContainerDocproc containerDocproc;
private ContainerDocumentApi containerDocumentApi;
private SecretStore secretStore;
+ private final ContainerThreadpool defaultHandlerThreadpool = new Handler.DefaultHandlerThreadpool();
private boolean rpcServerEnabled = true;
private boolean httpServerEnabled = true;
@@ -181,6 +184,7 @@ public abstract class ContainerCluster<CONTAINER extends Container>
addCommonVespaBundles();
addSimpleComponent(AccessLog.class);
addComponent(new DefaultThreadpoolProvider(this, defaultPoolNumThreads));
+ addComponent(defaultHandlerThreadpool);
addSimpleComponent(com.yahoo.concurrent.classlock.ClassLocking.class);
addSimpleComponent("com.yahoo.container.jdisc.metric.MetricConsumerProviderProvider");
addSimpleComponent("com.yahoo.container.jdisc.metric.MetricProvider");
@@ -217,36 +221,45 @@ public abstract class ContainerCluster<CONTAINER extends Container>
}
public void addMetricStateHandler() {
- Handler<AbstractConfigProducer<?>> stateHandler = new Handler<>(
+ Handler stateHandler = new Handler(
new ComponentModel(STATE_HANDLER_CLASS, null, null, null));
stateHandler.addServerBindings(STATE_HANDLER_BINDING_1, STATE_HANDLER_BINDING_2);
addComponent(stateHandler);
}
public void addDefaultRootHandler() {
- Handler<AbstractConfigProducer<?>> handler = new Handler<>(
- new ComponentModel(BundleInstantiationSpecification.getFromStrings(
+ Handler handler = new Handler(
+ new ComponentModel(BundleInstantiationSpecification.fromStrings(
BINDINGS_OVERVIEW_HANDLER_CLASS, null, null), null)); // null bundle, as the handler is in container-disc
handler.addServerBindings(ROOT_HANDLER_BINDING);
addComponent(handler);
}
public void addApplicationStatusHandler() {
- Handler<AbstractConfigProducer<?>> statusHandler = new Handler<>(
- new ComponentModel(BundleInstantiationSpecification.getFromStrings(
+ Handler statusHandler = new Handler(
+ new ComponentModel(BundleInstantiationSpecification.fromStrings(
APPLICATION_STATUS_HANDLER_CLASS, null, null), null)); // null bundle, as the handler is in container-disc
statusHandler.addServerBindings(SystemBindingPattern.fromHttpPath("/ApplicationStatus"));
addComponent(statusHandler);
}
public void addVipHandler() {
- Handler<?> vipHandler = Handler.fromClassName(FileStatusHandlerComponent.CLASS);
+ Handler vipHandler = Handler.fromClassName(FileStatusHandlerComponent.CLASS);
vipHandler.addServerBindings(VIP_HANDLER_BINDING);
addComponent(vipHandler);
}
public final void addComponent(Component<?, ?> component) {
componentGroup.addComponent(component);
+ if (component instanceof Handler handler) {
+ ensureHandlerHasThreadpool(handler);
+ }
+ }
+
+ private void ensureHandlerHasThreadpool(Handler handler) {
+ if (! handler.hasCustomThreadPool) {
+ handler.inject(defaultHandlerThreadpool);
+ }
}
public final void addSimpleComponent(String idSpec, String classSpec, String bundleSpec) {
@@ -305,11 +318,9 @@ public abstract class ContainerCluster<CONTAINER extends Container>
this.processingChains = processingChains;
- // Cannot use the class object for ProcessingHandler, because its superclass is not accessible
ProcessingHandler<?> processingHandler = new ProcessingHandler<>(
processingChains,
- "com.yahoo.processing.handler.ProcessingHandler",
- null);
+ BundleInstantiationSpecification.fromStrings(PROCESSING_HANDLER_CLASS, null, null));
for (BindingPattern binding: serverBindings)
processingHandler.addServerBindings(binding);
@@ -368,9 +379,8 @@ public abstract class ContainerCluster<CONTAINER extends Container>
return containerDocproc.getChains();
}
- @SuppressWarnings("unchecked")
- public Collection<Handler<?>> getHandlers() {
- return (Collection<Handler<?>>)(Collection)componentGroup.getComponents(Handler.class);
+ public Collection<Handler> getHandlers() {
+ return componentGroup.getComponents(Handler.class);
}
public void setSecretStore(SecretStore secretStore) {