diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-01-17 13:21:28 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-01-17 13:21:28 +0100 |
commit | 5c84775483637e3bcf01323dafbe950461ead117 (patch) | |
tree | 6eeb0835127901c5a87832d6965656d5dfec649b /vespa-feed-client | |
parent | e9c1be52300dec6a8d9d1d32fed2be09a4f3807f (diff) |
Splitt lambda over multiple lines to easy see what caused exception.
Diffstat (limited to 'vespa-feed-client')
-rw-r--r-- | vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/ApacheCluster.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/ApacheCluster.java b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/ApacheCluster.java index 19f3ccf7a83..373985810f1 100644 --- a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/ApacheCluster.java +++ b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/ApacheCluster.java @@ -99,13 +99,16 @@ class ApacheCluster implements Cluster { } Future<?> future = endpoint.client.execute(request, - new FutureCallback<SimpleHttpResponse>() { + new FutureCallback<>() { @Override public void completed(SimpleHttpResponse response) { vessel.complete(new ApacheHttpResponse(response)); } @Override public void failed(Exception ex) { vessel.completeExceptionally(ex); } @Override public void cancelled() { vessel.cancel(false); } }); long timeoutMillis = wrapped.timeout() == null ? 200_000 : wrapped.timeout().toMillis() * 11 / 10 + 1_000; - Future<?> cancellation = timeoutExecutor.schedule(() -> { future.cancel(true); vessel.cancel(true); }, timeoutMillis, TimeUnit.MILLISECONDS); + Future<?> cancellation = timeoutExecutor.schedule(() -> { + future.cancel(true); + vessel.cancel(true); + }, timeoutMillis, TimeUnit.MILLISECONDS); vessel.whenComplete((__, ___) -> cancellation.cancel(true)); } catch (Throwable thrown) { |