Inject feed-handler thread pool to /doc/v1
@@ -23,23 +23,24 @@ public class ContainerDocumentApi {
public static final String DOCUMENT_V1_PREFIX = "/document/v1";
public ContainerDocumentApi(ContainerCluster<?> cluster, Options options) {
- addRestApiHandler(cluster, options);
- addFeedHandler(cluster, options);
+ var executor = new Threadpool("feedapi-handler", cluster, options.feedApiThreadpoolOptions);
+ cluster.addComponent(executor);
+ addRestApiHandler(cluster, options, executor);
+ addFeedHandler(cluster, options, executor);
}
- private static void addFeedHandler(ContainerCluster<?> cluster, Options options) {
+ private static void addFeedHandler(ContainerCluster<?> cluster, Options options, Threadpool executor) {
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) {
+ private static void addRestApiHandler(ContainerCluster<?> cluster, Options options, Threadpool executor) {
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.
