aboutsummaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2021-12-06 14:35:27 +0100
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2021-12-06 17:23:01 +0100
commit2c8d19b82de5ec4b47a5eb4ab566bbcb1725d118 (patch)
tree1d535de3b8621d827c6657edfb1eb26fa803410d /application
parentffdbd053a2b57383b2d463e8050394776b14abdf (diff)
Deprecate public APIs using Guava's ListenableFuture
Public methods: - com.yahoo.processing.rendering.Renderer.render() - com.yahoo.search.handler.HttpSearchResponse.waitableRender() - com.yahoo.processing.rendering.AsynchronousSectionedRenderer.renderBeforeHandover()
Diffstat (limited to 'application')
-rw-r--r--application/abi-spec.json2
-rw-r--r--application/src/main/java/com/yahoo/application/container/Processing.java12
-rw-r--r--application/src/main/java/com/yahoo/application/container/ProcessingBase.java16
-rw-r--r--application/src/main/java/com/yahoo/application/container/Search.java13
4 files changed, 20 insertions, 23 deletions
diff --git a/application/abi-spec.json b/application/abi-spec.json
index 5c298471b9c..2138f12854c 100644
--- a/application/abi-spec.json
+++ b/application/abi-spec.json
@@ -347,7 +347,7 @@
"public final com.yahoo.processing.Response process(com.yahoo.component.ComponentSpecification, com.yahoo.processing.Request)",
"protected abstract com.yahoo.processing.Response doProcess(com.yahoo.component.chain.Chain, com.yahoo.processing.Request)",
"public final byte[] processAndRender(com.yahoo.component.ComponentSpecification, com.yahoo.component.ComponentSpecification, com.yahoo.processing.Request)",
- "protected abstract com.google.common.util.concurrent.ListenableFuture doProcessAndRender(com.yahoo.component.ComponentSpecification, com.yahoo.processing.Request, com.yahoo.processing.rendering.Renderer, java.io.ByteArrayOutputStream)",
+ "protected abstract java.util.concurrent.CompletableFuture doProcessAndRender(com.yahoo.component.ComponentSpecification, com.yahoo.processing.Request, com.yahoo.processing.rendering.Renderer, java.io.ByteArrayOutputStream)",
"protected com.yahoo.component.chain.Chain getChain(com.yahoo.component.ComponentSpecification)",
"protected final com.yahoo.processing.rendering.Renderer getRenderer(com.yahoo.component.ComponentSpecification)",
"protected abstract com.yahoo.processing.rendering.Renderer doGetRenderer(com.yahoo.component.ComponentSpecification)"
diff --git a/application/src/main/java/com/yahoo/application/container/Processing.java b/application/src/main/java/com/yahoo/application/container/Processing.java
index 1f96fe2294b..4ca367ea720 100644
--- a/application/src/main/java/com/yahoo/application/container/Processing.java
+++ b/application/src/main/java/com/yahoo/application/container/Processing.java
@@ -2,7 +2,6 @@
package com.yahoo.application.container;
import com.yahoo.api.annotations.Beta;
-import com.google.common.util.concurrent.ListenableFuture;
import com.yahoo.component.ComponentSpecification;
import com.yahoo.component.chain.Chain;
import com.yahoo.processing.Processor;
@@ -15,6 +14,7 @@ import com.yahoo.processing.rendering.Renderer;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.util.concurrent.CompletableFuture;
/**
* @author Einar M R Rosenvinge
@@ -41,14 +41,14 @@ public final class Processing extends ProcessingBase<Request, Response, Processo
}
@Override
- protected ListenableFuture<Boolean> doProcessAndRender(ComponentSpecification chainSpec,
- Request request,
- Renderer<Response> renderer,
- ByteArrayOutputStream stream) throws IOException {
+ protected CompletableFuture<Boolean> doProcessAndRender(ComponentSpecification chainSpec,
+ Request request,
+ Renderer<Response> renderer,
+ ByteArrayOutputStream stream) throws IOException {
Execution execution = handler.createExecution(getChain(chainSpec), request);
Response response = execution.process(request);
- return renderer.render(stream, response, execution, request);
+ return renderer.renderResponse(stream, response, execution, request);
}
@Override
diff --git a/application/src/main/java/com/yahoo/application/container/ProcessingBase.java b/application/src/main/java/com/yahoo/application/container/ProcessingBase.java
index 2b4ea822d03..96866b94e29 100644
--- a/application/src/main/java/com/yahoo/application/container/ProcessingBase.java
+++ b/application/src/main/java/com/yahoo/application/container/ProcessingBase.java
@@ -2,20 +2,18 @@
package com.yahoo.application.container;
import com.yahoo.api.annotations.Beta;
-import com.google.common.util.concurrent.ListenableFuture;
import com.yahoo.component.ComponentSpecification;
import com.yahoo.component.chain.Chain;
import com.yahoo.processing.Processor;
import com.yahoo.processing.Request;
import com.yahoo.processing.Response;
import com.yahoo.processing.execution.chain.ChainRegistry;
-import com.yahoo.processing.rendering.AsynchronousRenderer;
import com.yahoo.processing.rendering.Renderer;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executors;
/**
* @author gjoranv
@@ -45,13 +43,13 @@ public abstract class ProcessingBase<REQUEST extends Request, RESPONSE extends R
REQUEST request) throws IOException {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
Renderer<RESPONSE> renderer = getRenderer(rendererSpec);
- ListenableFuture<Boolean> renderTask = doProcessAndRender(chainSpec, request, renderer, stream);
+ CompletableFuture<Boolean> renderTask = doProcessAndRender(chainSpec, request, renderer, stream);
awaitFuture(renderTask);
return stream.toByteArray();
}
- private void awaitFuture(ListenableFuture<Boolean> renderTask) {
+ private void awaitFuture(CompletableFuture<Boolean> renderTask) {
try {
renderTask.get();
} catch (InterruptedException | ExecutionException e) {
@@ -59,10 +57,10 @@ public abstract class ProcessingBase<REQUEST extends Request, RESPONSE extends R
}
}
- protected abstract ListenableFuture<Boolean> doProcessAndRender(ComponentSpecification chainSpec,
- REQUEST request,
- Renderer<RESPONSE> renderer,
- ByteArrayOutputStream stream) throws IOException ;
+ protected abstract CompletableFuture<Boolean> doProcessAndRender(ComponentSpecification chainSpec,
+ REQUEST request,
+ Renderer<RESPONSE> renderer,
+ ByteArrayOutputStream stream) throws IOException ;
protected Chain<PROCESSOR> getChain(ComponentSpecification chainSpec) {
Chain<PROCESSOR> chain = getChains().getComponent(chainSpec);
diff --git a/application/src/main/java/com/yahoo/application/container/Search.java b/application/src/main/java/com/yahoo/application/container/Search.java
index 3535b660b78..6a2f728fbcc 100644
--- a/application/src/main/java/com/yahoo/application/container/Search.java
+++ b/application/src/main/java/com/yahoo/application/container/Search.java
@@ -2,7 +2,6 @@
package com.yahoo.application.container;
import com.yahoo.api.annotations.Beta;
-import com.google.common.util.concurrent.ListenableFuture;
import com.yahoo.component.ComponentSpecification;
import com.yahoo.component.chain.Chain;
import com.yahoo.processing.execution.chain.ChainRegistry;
@@ -12,10 +11,10 @@ import com.yahoo.search.Result;
import com.yahoo.search.Searcher;
import com.yahoo.search.handler.HttpSearchResponse;
import com.yahoo.search.handler.SearchHandler;
-import com.yahoo.search.searchchain.SearchChainRegistry;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.util.concurrent.CompletableFuture;
/**
* @author Einar M R Rosenvinge
@@ -41,12 +40,12 @@ public final class Search extends ProcessingBase<Query, Result, Searcher> {
}
@Override
- protected ListenableFuture<Boolean> doProcessAndRender(ComponentSpecification chainSpec,
- Query request,
- Renderer<Result> renderer,
- ByteArrayOutputStream stream) throws IOException {
+ protected CompletableFuture<Boolean> doProcessAndRender(ComponentSpecification chainSpec,
+ Query request,
+ Renderer<Result> renderer,
+ ByteArrayOutputStream stream) throws IOException {
Result result = process(chainSpec, request);
- return HttpSearchResponse.waitableRender(result, result.getQuery(), renderer, stream);
+ return HttpSearchResponse.asyncRender(result, result.getQuery(), renderer, stream);
}
@Override