summaryrefslogtreecommitdiffstats
path: root/container-core/src/main/java/com/yahoo
diff options
context:
space:
mode:
authorgjoranv <gv@verizonmedia.com>2021-12-16 13:01:59 +0100
committergjoranv <gv@verizonmedia.com>2021-12-16 23:48:58 +0100
commit7f618cd283ff6a9c954abef6ff786cf9b3609141 (patch)
tree5279be1b6e9ad1867fbbcab3e178da5066f2a373 /container-core/src/main/java/com/yahoo
parent69cc74e83ab403bcbb17e2cf1816f6b85e7d3f96 (diff)
Put back Context class to LoggingRequestHandler
- Necessary for backwards binary compatibility for bundles built with older Vespa versions. - Will shade the one in ThreadedHttpRequestHandler. - Use a diferent name for the static test util function to avoid name collision. - Add both Context types to the component graph until Vespa 8.
Diffstat (limited to 'container-core/src/main/java/com/yahoo')
-rw-r--r--container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java40
-rw-r--r--container-core/src/main/java/com/yahoo/container/jdisc/ThreadedHttpRequestHandler.java11
2 files changed, 42 insertions, 9 deletions
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 ed884d104ed..b6e370dd911 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
@@ -29,6 +29,46 @@ import java.util.logging.Level;
// TODO Vespa 8: Remove deprecated constructors
public abstract class LoggingRequestHandler extends ThreadedHttpRequestHandler {
+ // TODO: Deprecate
+ public static class Context {
+
+ final Executor executor;
+ final Metric metric;
+
+ /** @deprecated Use {@link #Context(Executor, Metric)} instead */
+ @Deprecated(forRemoval = true, since = "7")
+ public Context(Executor executor, AccessLog ignored, Metric metric) {
+ this(executor, metric);
+ }
+
+ @Inject
+ public Context(Executor executor, Metric metric) {
+ this.executor = executor;
+ this.metric = metric;
+ }
+
+ public Context(Context other) {
+ this.executor = other.executor;
+ this.metric = other.metric;
+ }
+
+ public Executor getExecutor() { return executor; }
+ @Deprecated(forRemoval = true, since = "7") public AccessLog getAccessLog() { return null; }
+ public Metric getMetric() { return metric; }
+
+ }
+
+ // TODO: Deprecate
+ public static Context testOnlyContext() {
+ return new Context(new Executor() {
+ @Override
+ public void execute(Runnable command) {
+ command.run();
+ }
+ },
+ null);
+ }
+
@Inject
public LoggingRequestHandler(Context ctx) {
this(ctx.executor, ctx.metric);
diff --git a/container-core/src/main/java/com/yahoo/container/jdisc/ThreadedHttpRequestHandler.java b/container-core/src/main/java/com/yahoo/container/jdisc/ThreadedHttpRequestHandler.java
index 3cd20f64ca1..722f1850013 100644
--- a/container-core/src/main/java/com/yahoo/container/jdisc/ThreadedHttpRequestHandler.java
+++ b/container-core/src/main/java/com/yahoo/container/jdisc/ThreadedHttpRequestHandler.java
@@ -255,15 +255,8 @@ public abstract class ThreadedHttpRequestHandler extends ThreadedRequestHandler
return (com.yahoo.jdisc.http.HttpRequest) request;
}
-
- public static Context testOnlyContext() {
- return new Context(new Executor() {
- @Override
- public void execute(Runnable command) {
- command.run();
- }
- },
- null);
+ public static Context testContext() {
+ return new Context(Runnable::run, null);
}
public static class Context {