summaryrefslogtreecommitdiffstats
path: root/vespa-http-client
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2017-09-26 16:37:09 -0700
committerJon Bratseth <bratseth@yahoo-inc.com>2017-09-26 16:37:09 -0700
commit15c77bf1ed7055b345419b0f8e2206339a72dd60 (patch)
tree4f5fd7ea497a4dcaa8c53b34ce9849822f7a1c38 /vespa-http-client
parentf8fd0fed643bf928804af1b25e6551ab6d2594e1 (diff)
Return permissions before calling listener
In the wild we have seen code which makes new send requests from ther onCompletion implementation. When permissions to send are not returned until onComplete returns, this can lead to deadlock. Returning permissions earlier removes this possibility and seems semantically correct to me.
Diffstat (limited to 'vespa-http-client')
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationProcessor.java11
1 files changed, 4 insertions, 7 deletions
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationProcessor.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationProcessor.java
index 37def9b9a54..7cea767f9ba 100644
--- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationProcessor.java
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationProcessor.java
@@ -192,13 +192,10 @@ public class OperationProcessor {
final Result result = process(endpointResult, clusterId);
if (result != null) {
- try {
- resultCallback.onCompletion(result.getDocumentId(), result);
- if (traceToStderr && result.hasLocalTrace()) {
- System.err.println(result.toString());
- }
- } finally {
- incompleteResultsThrottler.resultReady(result.isSuccess());
+ incompleteResultsThrottler.resultReady(result.isSuccess());
+ resultCallback.onCompletion(result.getDocumentId(), result);
+ if (traceToStderr && result.hasLocalTrace()) {
+ System.err.println(result.toString());
}
}
}