summaryrefslogtreecommitdiffstats
path: root/jdisc_http_service
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@oath.com>2017-12-15 16:09:57 +0100
committerBjørn Christian Seime <bjorncs@oath.com>2017-12-15 16:09:58 +0100
commit6a6330ae275706706ccb59a5046943e1081aa606 (patch)
treec4d9f2ecaab886ae8e9a98021a77782ee01f5b6e /jdisc_http_service
parent77242dcd5594b4b481403491c47979cc866a569c (diff)
EofException is always wrapped in CompletionException
Also change logging to use Supplier<String> to avoid unnecessary String instantiations.
Diffstat (limited to 'jdisc_http_service')
-rw-r--r--jdisc_http_service/src/main/java/com/yahoo/jdisc/http/server/jetty/HttpRequestDispatch.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/server/jetty/HttpRequestDispatch.java b/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/server/jetty/HttpRequestDispatch.java
index 5cabe8acd27..31268c823ba 100644
--- a/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/server/jetty/HttpRequestDispatch.java
+++ b/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/server/jetty/HttpRequestDispatch.java
@@ -22,6 +22,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
@@ -34,6 +35,7 @@ import static com.yahoo.jdisc.http.server.jetty.Exceptions.throwUnchecked;
/**
* @author Simon Thoresen Hult
+ * @author bjorncs
*/
class HttpRequestDispatch {
@@ -123,10 +125,10 @@ class HttpRequestDispatch {
boolean reportedError = false;
if (error != null) {
- if (error instanceof EofException) {
+ if (error instanceof CompletionException && error.getCause() instanceof EofException) {
log.log(Level.FINE,
- "Network connection was unexpectedly terminated: " + parent.servletRequest.getRequestURI(),
- error);
+ error,
+ () -> "Network connection was unexpectedly terminated: " + parent.servletRequest.getRequestURI());
} else if (!(error instanceof OverloadException || error instanceof BindingNotFoundException)) {
log.log(Level.WARNING, "Request failed: " + parent.servletRequest.getRequestURI(), error);
}