aboutsummaryrefslogtreecommitdiffstats
path: root/container-core/src/main/java/com/yahoo/processing/rendering/Renderer.java
diff options
context:
space:
mode:
Diffstat (limited to 'container-core/src/main/java/com/yahoo/processing/rendering/Renderer.java')
-rw-r--r--container-core/src/main/java/com/yahoo/processing/rendering/Renderer.java22
1 files changed, 19 insertions, 3 deletions
diff --git a/container-core/src/main/java/com/yahoo/processing/rendering/Renderer.java b/container-core/src/main/java/com/yahoo/processing/rendering/Renderer.java
index 14ec3002b0a..8db4ed4f624 100644
--- a/container-core/src/main/java/com/yahoo/processing/rendering/Renderer.java
+++ b/container-core/src/main/java/com/yahoo/processing/rendering/Renderer.java
@@ -3,11 +3,13 @@ package com.yahoo.processing.rendering;
import com.google.common.util.concurrent.ListenableFuture;
import com.yahoo.component.AbstractComponent;
+import com.yahoo.concurrent.CompletableFutures;
import com.yahoo.processing.Request;
import com.yahoo.processing.Response;
import com.yahoo.processing.execution.Execution;
import java.io.OutputStream;
+import java.util.concurrent.CompletableFuture;
/**
* Renders a response to a stream. The renderers are cloned just before
@@ -41,6 +43,17 @@ public abstract class Renderer<RESPONSE extends Response> extends AbstractCompon
}
/**
+ * @deprecated Use/implement {@link #renderResponse(OutputStream, Response, Execution, Request)} instead.
+ * Return type changed from {@link ListenableFuture} to {@link CompletableFuture}.
+ */
+ @Deprecated(forRemoval = true, since = "7")
+ @SuppressWarnings("removal")
+ public ListenableFuture<Boolean> render(OutputStream stream, RESPONSE response, Execution execution,
+ Request request) {
+ return CompletableFutures.toGuavaListenableFuture(renderResponse(stream, response, execution, request));
+ }
+
+ /**
* Render a response to a stream. The stream also exposes a ByteBuffer API
* for efficient transactions to JDisc. The returned future will throw the
* exception causing failure wrapped in an ExecutionException if rendering
@@ -50,10 +63,13 @@ public abstract class Renderer<RESPONSE extends Response> extends AbstractCompon
* @param response the response to render
* @param execution the execution which created this response
* @param request the request matching the response
- * @return a ListenableFuture containing a boolean where true indicates a successful rendering
+ * @return a {@link CompletableFuture} containing a boolean where true indicates a successful rendering
*/
- public abstract ListenableFuture<Boolean> render(OutputStream stream, RESPONSE response,
- Execution execution, Request request);
+ @SuppressWarnings("removal")
+ public CompletableFuture<Boolean> renderResponse(OutputStream stream, RESPONSE response,
+ Execution execution, Request request) {
+ return CompletableFutures.toCompletableFuture(render(stream, response, execution, request));
+ }
/**
* Name of the output encoding, if applicable.