diff options
author | Jon Marius Venstad <jonmv@users.noreply.github.com> | 2021-10-22 11:49:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-22 11:49:42 +0200 |
commit | 497ea2b9227115f6b0b9d3d1cdadecc14ab23380 (patch) | |
tree | 181bb6f4fafc443ff4ebaa0096aa9490afdd9fa5 | |
parent | 4dfa0661972e0b42135727598658795995f34131 (diff) | |
parent | f1285b0000cc6c1c088e388c54e9dd85c3a055e1 (diff) |
Merge pull request #19699 from vespa-engine/jonmv/default-executor-for-streamed-visits
Jonmv/default executor for streamed visits
3 files changed, 10 insertions, 12 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/clients/ContainerDocumentApi.java b/config-model/src/main/java/com/yahoo/vespa/model/clients/ContainerDocumentApi.java index 0177aa6b2e8..8534e1f65a7 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/clients/ContainerDocumentApi.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/clients/ContainerDocumentApi.java @@ -23,24 +23,23 @@ public class ContainerDocumentApi { public static final String DOCUMENT_V1_PREFIX = "/document/v1"; public ContainerDocumentApi(ContainerCluster<?> cluster, Options options) { - var executor = new Threadpool("feedapi-handler", cluster, options.feedApiThreadpoolOptions); - cluster.addComponent(executor); - addRestApiHandler(cluster, options, executor); - addFeedHandler(cluster, options, executor); + addRestApiHandler(cluster, options); + addFeedHandler(cluster, options); } - private static void addFeedHandler(ContainerCluster<?> cluster, Options options, Threadpool executor) { + private static void addFeedHandler(ContainerCluster<?> cluster, Options options) { String bindingSuffix = ContainerCluster.RESERVED_URI_PREFIX + "/feedapi"; var handler = newVespaClientHandler("com.yahoo.vespa.http.server.FeedHandler", bindingSuffix, options); cluster.addComponent(handler); + var executor = new Threadpool("feedapi-handler", cluster, options.feedApiThreadpoolOptions); handler.inject(executor); + handler.addComponent(executor); } - private static void addRestApiHandler(ContainerCluster<?> cluster, Options options, Threadpool executor) { + private static void addRestApiHandler(ContainerCluster<?> cluster, Options options) { var handler = newVespaClientHandler("com.yahoo.document.restapi.resource.DocumentV1ApiHandler", DOCUMENT_V1_PREFIX + "/*", options); cluster.addComponent(handler); - handler.inject(executor); // We need to include a dummy implementation of the previous restapi handler (using the same class name). // The internal legacy test framework requires that the name of the old handler is listed in /ApplicationStatus. diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/ContainerDocumentApiBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/ContainerDocumentApiBuilderTest.java index b52f797dae3..ed26dafe60c 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/ContainerDocumentApiBuilderTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/ContainerDocumentApiBuilderTest.java @@ -105,7 +105,7 @@ public class ContainerDocumentApiBuilderTest extends ContainerModelBuilderTestBa assertThat(injectedComponentIds, hasItem("threadpool@feedapi-handler")); ContainerThreadpoolConfig config = root.getConfig( - ContainerThreadpoolConfig.class, "cluster1/component/threadpool@feedapi-handler"); + ContainerThreadpoolConfig.class, "cluster1/component/com.yahoo.vespa.http.server.FeedHandler/threadpool@feedapi-handler"); assertEquals(-4, config.maxThreads()); assertEquals(-4, config.minThreads()); } @@ -128,7 +128,7 @@ public class ContainerDocumentApiBuilderTest extends ContainerModelBuilderTestBa createModel(root, elem); ContainerThreadpoolConfig feedThreadpoolConfig = root.getConfig( - ContainerThreadpoolConfig.class, "cluster1/component/threadpool@feedapi-handler"); + ContainerThreadpoolConfig.class, "cluster1/component/com.yahoo.vespa.http.server.FeedHandler/threadpool@feedapi-handler"); assertEquals(50, feedThreadpoolConfig.maxThreads()); assertEquals(25, feedThreadpoolConfig.minThreads()); assertEquals(1000, feedThreadpoolConfig.queueSize()); diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java index a3e3c512dcd..e5667c7b392 100644 --- a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java +++ b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java @@ -8,7 +8,6 @@ import com.yahoo.cloud.config.ClusterListConfig; import com.yahoo.concurrent.DaemonThreadFactory; import com.yahoo.container.core.HandlerMetricContextUtil; import com.yahoo.container.core.documentapi.VespaDocumentAccess; -import com.yahoo.container.handler.threadpool.ContainerThreadPool; import com.yahoo.container.jdisc.ContentChannelOutputStream; import com.yahoo.container.jdisc.MaxPendingContentChannelOutputStream; import com.yahoo.document.Document; @@ -184,7 +183,7 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler { private final Map<String, Map<Method, Handler>> handlers = defineApi(); @Inject - public DocumentV1ApiHandler(ContainerThreadPool threadPool, + public DocumentV1ApiHandler(Executor defaultExecutor, Metric metric, MetricReceiver metricReceiver, VespaDocumentAccess documentAccess, @@ -193,7 +192,7 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler { AllClustersBucketSpacesConfig bucketSpacesConfig, DocumentOperationExecutorConfig executorConfig) { this(Clock.systemUTC(), Duration.ofSeconds(5), metric, metricReceiver, documentAccess, - documentManagerConfig, executorConfig, clusterListConfig, bucketSpacesConfig, threadPool.executor()); + documentManagerConfig, executorConfig, clusterListConfig, bucketSpacesConfig, defaultExecutor); } DocumentV1ApiHandler(Clock clock, Duration handlerTimeout, Metric metric, MetricReceiver metricReceiver, DocumentAccess access, |