summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StateRestApiV2Handler.java14
-rw-r--r--clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StatusHandler.java13
-rw-r--r--clustercontroller-apps/src/test/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StateRestApiV2HandlerTest.java5
-rw-r--r--clustercontroller-apps/src/test/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StatusHandlerTest.java5
-rw-r--r--clustercontroller-apputil/src/main/java/com/yahoo/vespa/clustercontroller/apputil/communication/http/JDiscHttpRequestHandler.java6
5 files changed, 18 insertions, 25 deletions
diff --git a/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StateRestApiV2Handler.java b/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StateRestApiV2Handler.java
index eea085bd103..7f0acd83b0d 100644
--- a/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StateRestApiV2Handler.java
+++ b/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StateRestApiV2Handler.java
@@ -3,7 +3,6 @@ package com.yahoo.vespa.clustercontroller.apps.clustercontroller;
import com.google.inject.Inject;
import com.yahoo.cloud.config.ClusterInfoConfig;
-import com.yahoo.container.logging.AccessLog;
import com.yahoo.log.LogLevel;
import com.yahoo.vespa.clustercontroller.apputil.communication.http.JDiscHttpRequestHandler;
import com.yahoo.vespa.clustercontroller.core.restapiv2.ClusterControllerStateRestAPI;
@@ -13,19 +12,22 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
-import java.util.concurrent.Executor;
import java.util.logging.Logger;
public class StateRestApiV2Handler extends JDiscHttpRequestHandler {
private static final Logger log = Logger.getLogger(StateRestApiV2Handler.class.getName());
@Inject
- public StateRestApiV2Handler(Executor executor, ClusterController cc, ClusterInfoConfig config, AccessLog accessLog) {
- this(executor, new ClusterControllerStateRestAPI(cc, getClusterControllerSockets(config)), "/cluster/v2", accessLog);
+ public StateRestApiV2Handler(ClusterController cc, ClusterInfoConfig config,
+ JDiscHttpRequestHandler.Context ctx)
+ {
+ this(new ClusterControllerStateRestAPI(cc, getClusterControllerSockets(config)), "/cluster/v2", ctx);
}
- private StateRestApiV2Handler(Executor executor, ClusterControllerStateRestAPI restApi, String pathPrefix, AccessLog accessLog) {
- super(new RestApiHandler(restApi).setDefaultPathPrefix(pathPrefix), executor, accessLog);
+ private StateRestApiV2Handler(ClusterControllerStateRestAPI restApi, String pathPrefix,
+ JDiscHttpRequestHandler.Context ctx)
+ {
+ super(new RestApiHandler(restApi).setDefaultPathPrefix(pathPrefix), ctx);
}
// This method is package-private instead of private to be accessible to unit-tests.
diff --git a/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StatusHandler.java b/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StatusHandler.java
index ae7c32e0f95..6817a033675 100644
--- a/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StatusHandler.java
+++ b/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StatusHandler.java
@@ -2,22 +2,21 @@
package com.yahoo.vespa.clustercontroller.apps.clustercontroller;
import com.google.inject.Inject;
-import com.yahoo.container.logging.AccessLog;
import com.yahoo.vespa.clustercontroller.apputil.communication.http.JDiscHttpRequestHandler;
-import java.util.concurrent.Executor;
-
public class StatusHandler extends JDiscHttpRequestHandler {
private final com.yahoo.vespa.clustercontroller.core.status.StatusHandler statusHandler;
@Inject
- public StatusHandler(ClusterController fc, Executor executor, AccessLog accessLog) {
- this(new com.yahoo.vespa.clustercontroller.core.status.StatusHandler(fc), executor, accessLog);
+ public StatusHandler(ClusterController fc, JDiscHttpRequestHandler.Context ctx) {
+ this(new com.yahoo.vespa.clustercontroller.core.status.StatusHandler(fc), ctx);
}
- private StatusHandler(com.yahoo.vespa.clustercontroller.core.status.StatusHandler handler, Executor executor, AccessLog accessLog) {
- super(handler, executor, accessLog);
+ private StatusHandler(com.yahoo.vespa.clustercontroller.core.status.StatusHandler handler,
+ JDiscHttpRequestHandler.Context ctx)
+ {
+ super(handler, ctx);
this.statusHandler = handler;
}
diff --git a/clustercontroller-apps/src/test/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StateRestApiV2HandlerTest.java b/clustercontroller-apps/src/test/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StateRestApiV2HandlerTest.java
index 524aba1398b..dbc7834a601 100644
--- a/clustercontroller-apps/src/test/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StateRestApiV2HandlerTest.java
+++ b/clustercontroller-apps/src/test/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StateRestApiV2HandlerTest.java
@@ -2,7 +2,6 @@
package com.yahoo.vespa.clustercontroller.apps.clustercontroller;
import com.yahoo.cloud.config.ClusterInfoConfig;
-import com.yahoo.container.logging.AccessLog;
import com.yahoo.vespa.clustercontroller.core.restapiv2.ClusterControllerStateRestAPI;
import junit.framework.TestCase;
@@ -15,13 +14,11 @@ import java.util.concurrent.TimeUnit;
public class StateRestApiV2HandlerTest extends TestCase {
public void testNoMatchingSockets() {
- ThreadPoolExecutor executor = new ThreadPoolExecutor(10, 100, 100, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(1000));
ClusterController controller = new ClusterController();
ClusterInfoConfig config = new ClusterInfoConfig(
new ClusterInfoConfig.Builder().clusterId("cluster-id").nodeCount(1));
ClusterInfoConfig.Builder clusterConfig = new ClusterInfoConfig.Builder();
- new StateRestApiV2Handler(executor, controller, config, AccessLog.voidAccessLog());
- executor.shutdown();
+ new StateRestApiV2Handler(controller, config, StateRestApiV2Handler.testOnlyContext());
}
public void testMappingOfIndexToClusterControllers() {
diff --git a/clustercontroller-apps/src/test/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StatusHandlerTest.java b/clustercontroller-apps/src/test/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StatusHandlerTest.java
index 66cb477e793..49e0a637368 100644
--- a/clustercontroller-apps/src/test/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StatusHandlerTest.java
+++ b/clustercontroller-apps/src/test/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StatusHandlerTest.java
@@ -1,7 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.clustercontroller.apps.clustercontroller;
-import com.yahoo.container.logging.AccessLog;
import junit.framework.TestCase;
import java.util.concurrent.ArrayBlockingQueue;
@@ -12,9 +11,7 @@ public class StatusHandlerTest extends TestCase {
public void testSimple() {
ClusterController controller = new ClusterController();
- ThreadPoolExecutor executor = new ThreadPoolExecutor(10, 100, 100, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(1000));
- StatusHandler handler = new StatusHandler(controller, executor, AccessLog.voidAccessLog());
- executor.shutdown();
+ StatusHandler handler = new StatusHandler(controller, StatusHandler.testOnlyContext());
}
}
diff --git a/clustercontroller-apputil/src/main/java/com/yahoo/vespa/clustercontroller/apputil/communication/http/JDiscHttpRequestHandler.java b/clustercontroller-apputil/src/main/java/com/yahoo/vespa/clustercontroller/apputil/communication/http/JDiscHttpRequestHandler.java
index f43f04d1aac..2029630a5de 100644
--- a/clustercontroller-apputil/src/main/java/com/yahoo/vespa/clustercontroller/apputil/communication/http/JDiscHttpRequestHandler.java
+++ b/clustercontroller-apputil/src/main/java/com/yahoo/vespa/clustercontroller/apputil/communication/http/JDiscHttpRequestHandler.java
@@ -2,7 +2,6 @@
package com.yahoo.vespa.clustercontroller.apputil.communication.http;
import com.yahoo.container.jdisc.LoggingRequestHandler;
-import com.yahoo.container.logging.AccessLog;
import com.yahoo.jdisc.HeaderFields;
import com.yahoo.jdisc.Response;
import com.yahoo.jdisc.handler.CompletionHandler;
@@ -14,7 +13,6 @@ import org.apache.commons.io.IOUtils;
import java.io.*;
import java.time.Duration;
-import java.util.concurrent.Executor;
import java.util.logging.Logger;
/**
@@ -29,8 +27,8 @@ public class JDiscHttpRequestHandler extends LoggingRequestHandler {
private static final Logger log = Logger.getLogger(JDiscHttpRequestHandler.class.getName());
private final HttpRequestHandler requestHandler;
- public JDiscHttpRequestHandler(HttpRequestHandler handler, Executor executor, AccessLog accessLog) {
- super(executor, accessLog);
+ public JDiscHttpRequestHandler(HttpRequestHandler handler, LoggingRequestHandler.Context parentCtx) {
+ super(parentCtx);
this.requestHandler = handler;
}