summaryrefslogtreecommitdiffstats
path: root/jdisc_http_service
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@yahoo-inc.com>2016-06-21 12:57:14 +0200
committerBjørn Christian Seime <bjorncs@yahoo-inc.com>2016-06-21 12:57:14 +0200
commitf6773e61e61b7147226b999d2a904ce179030603 (patch)
tree7b1f4664b1aacecf5fee9c3eb7f7b374c03cdf56 /jdisc_http_service
parentc2178aeada83f9152069d231934cb338b340b32a (diff)
Moved code section to obtain more logical order.
Diffstat (limited to 'jdisc_http_service')
-rw-r--r--jdisc_http_service/src/main/java/com/yahoo/jdisc/http/server/jetty/HttpRequestDispatch.java15
1 files changed, 7 insertions, 8 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 e9aba0cb6c9..c16ac589332 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
@@ -101,6 +101,13 @@ class HttpRequestDispatch {
HttpRequestDispatch parent = this; //used to avoid binding uninitialized variables
completeRequestCallback = (result, error) -> {
+ boolean alreadyCalled = completeRequestCalled.getAndSet(true);
+ if (alreadyCalled) {
+ AssertionError e = new AssertionError("completeRequest called more than once");
+ log.log(Level.WARNING, "Assertion failed.", e);
+ throw e;
+ }
+
boolean reportedError = false;
if (error != null) {
@@ -113,14 +120,6 @@ class HttpRequestDispatch {
parent.metricReporter.successfulResponse();
}
-
- boolean alreadyCalled = completeRequestCalled.getAndSet(true);
- if (alreadyCalled) {
- AssertionError e = new AssertionError("completeRequest called more than once");
- log.log(Level.WARNING, "Assertion failed.", e);
- throw e;
- }
-
try {
parent.async.complete();
log.finest(() -> "Request completed successfully: " + parent.servletRequest.getRequestURI());