aboutsummaryrefslogtreecommitdiffstats
path: root/container-core/src/main
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2021-01-21 15:49:05 +0100
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2021-01-21 16:54:09 +0100
commit6cc469b7950f4f6f2b67596b162cd73e59c22336 (patch)
treeb19e9a8bf8c1bda395da8862494c3edafabf9b4e /container-core/src/main
parentbe7847731521fb516269b65905029c1639d4aec8 (diff)
Deprecate LoggingRequestHandler constructors taking AccessLog
Add replacement constructors without AccessLog. Remove use of deprecated constructors for internal handlers.
Diffstat (limited to 'container-core/src/main')
-rw-r--r--container-core/src/main/java/com/yahoo/container/handler/test/MockService.java7
-rw-r--r--container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java55
-rw-r--r--container-core/src/main/java/com/yahoo/processing/handler/AbstractProcessingHandler.java24
3 files changed, 43 insertions, 43 deletions
diff --git a/container-core/src/main/java/com/yahoo/container/handler/test/MockService.java b/container-core/src/main/java/com/yahoo/container/handler/test/MockService.java
index 0228bc06c51..625212bcfe9 100644
--- a/container-core/src/main/java/com/yahoo/container/handler/test/MockService.java
+++ b/container-core/src/main/java/com/yahoo/container/handler/test/MockService.java
@@ -5,7 +5,6 @@ import com.google.common.annotations.Beta;
import com.yahoo.container.jdisc.HttpRequest;
import com.yahoo.container.jdisc.HttpResponse;
import com.yahoo.container.jdisc.LoggingRequestHandler;
-import com.yahoo.container.logging.AccessLog;
import com.yahoo.filedistribution.fileacquirer.FileAcquirer;
import com.yahoo.jdisc.Metric;
@@ -19,7 +18,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
-import java.util.logging.Logger;
/**
* This is a generic http handler that can be used to mock a service when testing your application on jDISC.
@@ -50,14 +48,13 @@ public class MockService extends LoggingRequestHandler {
* A custom handler can be created by subclassing and overriding the createHandler method.
*
* @param executor used to create threads
- * @param accessLog where requests will be logged
* @param fileAcquirer used to fetch file from config
* @param config the mock config for this service
* @throws InterruptedException if unable to get data file within timeout
* @throws IOException if unable to create handler due to some IO errors
*/
- public MockService(Executor executor, AccessLog accessLog, FileAcquirer fileAcquirer, MockserviceConfig config, Metric metric) throws InterruptedException, IOException {
- super(executor, accessLog, metric);
+ public MockService(Executor executor, FileAcquirer fileAcquirer, MockserviceConfig config, Metric metric) throws InterruptedException, IOException {
+ super(executor, metric);
File dataFile = fileAcquirer.waitFor(config.file(), config.fileAcquirerTimeout(), TimeUnit.SECONDS);
this.handler = createHandler(dataFile);
}
diff --git a/container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java b/container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java
index 9bb9819cd1f..0d20fc05586 100644
--- a/container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java
+++ b/container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java
@@ -26,43 +26,33 @@ import java.util.logging.Level;
*
* @author Steinar Knutsen
*/
-// TODO Vespa 8: Deprecate all constructors taking AccessLog as parameter
+// TODO Vespa 8: Remove deprecated constructors
public abstract class LoggingRequestHandler extends ThreadedHttpRequestHandler {
- public LoggingRequestHandler(Executor executor, AccessLog ignored) {
- this(executor, ignored, null);
- }
-
- public LoggingRequestHandler(Executor executor) {
- this(executor, null, null);
- }
-
public static class Context {
final Executor executor;
- final AccessLog ignored;
final Metric metric;
- @Inject
+ /** @deprecated Use {@link #Context(Executor, Metric)} instead */
+ @Deprecated(forRemoval = true, since = "7")
public Context(Executor executor, AccessLog ignored, Metric metric) {
- this.executor = executor;
- this.ignored = ignored;
- this.metric = metric;
+ this(executor, metric);
}
-
+ @Inject
public Context(Executor executor, Metric metric) {
- this(executor, null, metric);
+ this.executor = executor;
+ this.metric = metric;
}
public Context(Context other) {
this.executor = other.executor;
- this.ignored = other.ignored;
this.metric = other.metric;
}
public Executor getExecutor() { return executor; }
- public AccessLog getAccessLog() { return ignored; }
+ @Deprecated(forRemoval = true, since = "7") public AccessLog getAccessLog() { return null; }
public Metric getMetric() { return metric; }
}
@@ -74,24 +64,45 @@ public abstract class LoggingRequestHandler extends ThreadedHttpRequestHandler {
command.run();
}
},
- AccessLog.voidAccessLog(),
null);
}
@Inject
public LoggingRequestHandler(Context ctx) {
- this(ctx.executor, ctx.ignored, ctx.metric);
+ this(ctx.executor, ctx.metric);
+ }
+
+ /** @deprecated Use {@link #LoggingRequestHandler(Executor)} instead */
+ @Deprecated(forRemoval = true, since = "7")
+ public LoggingRequestHandler(Executor executor, AccessLog ignored) {
+ this(executor, (Metric)null);
+ }
+
+ public LoggingRequestHandler(Executor executor) {
+ this(executor, (Metric)null);
}
public LoggingRequestHandler(Context ctx, boolean allowAsyncResponse) {
- this(ctx.executor, ctx.ignored, ctx.metric, allowAsyncResponse);
+ this(ctx.executor, ctx.metric, allowAsyncResponse);
+ }
+
+ public LoggingRequestHandler(Executor executor, Metric metric) {
+ this(executor, metric, false);
}
+ /** @deprecated Use {@link #LoggingRequestHandler(Executor, Metric)} instead */
+ @Deprecated(forRemoval = true, since = "7")
public LoggingRequestHandler(Executor executor, AccessLog ignored, Metric metric) {
- this(executor, ignored, metric, false);
+ this(executor, metric, false);
}
+ /** @deprecated Use {@link #LoggingRequestHandler(Executor, Metric, boolean)} instead */
+ @Deprecated(forRemoval = true, since = "7")
public LoggingRequestHandler(Executor executor, AccessLog ignored, Metric metric, boolean allowAsyncResponse) {
+ this(executor, metric, allowAsyncResponse);
+ }
+
+ public LoggingRequestHandler(Executor executor, Metric metric, boolean allowAsyncResponse) {
super(executor, metric, allowAsyncResponse);
}
diff --git a/container-core/src/main/java/com/yahoo/processing/handler/AbstractProcessingHandler.java b/container-core/src/main/java/com/yahoo/processing/handler/AbstractProcessingHandler.java
index 6ab71c9a9dc..a4b2db74300 100644
--- a/container-core/src/main/java/com/yahoo/processing/handler/AbstractProcessingHandler.java
+++ b/container-core/src/main/java/com/yahoo/processing/handler/AbstractProcessingHandler.java
@@ -13,7 +13,6 @@ import com.yahoo.container.jdisc.ContentChannelOutputStream;
import com.yahoo.container.jdisc.HttpRequest;
import com.yahoo.container.jdisc.HttpResponse;
import com.yahoo.container.jdisc.LoggingRequestHandler;
-import com.yahoo.container.jdisc.VespaHeaders;
import com.yahoo.container.logging.AccessLog;
import com.yahoo.jdisc.Metric;
import com.yahoo.jdisc.handler.ContentChannel;
@@ -29,15 +28,8 @@ import com.yahoo.processing.rendering.Renderer;
import com.yahoo.processing.request.CompoundName;
import com.yahoo.processing.request.ErrorMessage;
import com.yahoo.processing.request.Properties;
-import com.yahoo.processing.response.Data;
-import com.yahoo.processing.response.DataList;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.concurrent.Executor;
import static com.yahoo.component.chain.ChainsConfigurer.prepareChainRegistry;
@@ -68,9 +60,9 @@ public abstract class AbstractProcessingHandler<COMPONENT extends Processor> ext
public AbstractProcessingHandler(ChainRegistry<COMPONENT> chainRegistry,
ComponentRegistry<Renderer> renderers,
Executor executor,
- AccessLog accessLog,
+ AccessLog ignored,
Metric metric) {
- super(executor, accessLog, metric, true);
+ super(executor, metric, true);
renderingExecutor = executor;
this.chainRegistry = chainRegistry;
this.renderers = renderers;
@@ -87,16 +79,16 @@ public abstract class AbstractProcessingHandler<COMPONENT extends Processor> ext
public AbstractProcessingHandler(ChainRegistry<COMPONENT> chainRegistry,
ComponentRegistry<Renderer> renderers,
Executor executor,
- AccessLog accessLog) {
- this(chainRegistry, renderers, executor, accessLog, null);
+ AccessLog ignored) {
+ this(chainRegistry, renderers, executor, ignored, null);
}
public AbstractProcessingHandler(ChainsConfig processingChainsConfig,
ComponentRegistry <COMPONENT> chainedComponents,
ComponentRegistry<Renderer> renderers,
Executor executor,
- AccessLog accessLog) {
- this(processingChainsConfig, chainedComponents, renderers, executor, accessLog, null);
+ AccessLog ignored) {
+ this(processingChainsConfig, chainedComponents, renderers, executor, ignored, null);
}
@Inject
@@ -104,9 +96,9 @@ public abstract class AbstractProcessingHandler<COMPONENT extends Processor> ext
ComponentRegistry<COMPONENT> chainedComponents,
ComponentRegistry<Renderer> renderers,
Executor executor,
- AccessLog accessLog,
+ AccessLog ignored,
Metric metric) {
- this(createChainRegistry(processingChainsConfig, chainedComponents), renderers, executor, accessLog, metric);
+ this(createChainRegistry(processingChainsConfig, chainedComponents), renderers, executor, ignored, metric);
}
/** Throws UnsupportedOperationException: Call handle(request, channel instead) */