diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-01-10 19:16:58 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-01-10 21:17:03 +0000 |
commit | c8a78cb2083cced90b2db6b7056dc61652607ca3 (patch) | |
tree | 4a5bc26179522e3f5f52f463df09a68566dc9971 /vespaclient-container-plugin | |
parent | 3e8db74b43e24f8499daa968968c94eeb4dedfc9 (diff) |
Do the costly stuff in the large threadpool, not in the single thread.
Conflicts:
vespaclient-container-plugin/src/main/java/com/yahoo/storage/searcher/GetSearcher.java
Diffstat (limited to 'vespaclient-container-plugin')
-rwxr-xr-x | vespaclient-container-plugin/src/main/java/com/yahoo/storage/searcher/GetSearcher.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/storage/searcher/GetSearcher.java b/vespaclient-container-plugin/src/main/java/com/yahoo/storage/searcher/GetSearcher.java index 79e2b47c6f3..4efe3a8321b 100755 --- a/vespaclient-container-plugin/src/main/java/com/yahoo/storage/searcher/GetSearcher.java +++ b/vespaclient-container-plugin/src/main/java/com/yahoo/storage/searcher/GetSearcher.java @@ -85,6 +85,7 @@ public class GetSearcher extends Searcher { private Map<String, Integer> ordering; private List<DocumentHit> documentHits = new ArrayList<>(); private List<DefaultErrorHit> errorHits = new ArrayList<>(); + private List<Reply> replies = new ArrayList<>(); public GetResponse(List<String> documentIds) { ordering = new HashMap<>(documentIds.size()); @@ -110,6 +111,15 @@ public class GetSearcher extends Searcher { String str = reply.getTrace().toString(); log.log(LogLevel.DEBUG, str); } + replies.add(reply); + return numPending > 0; + } + private void processReplies() { + for (Reply reply : replies) { + processReply(reply); + } + } + private void processReply(Reply reply) { if (!reply.hasErrors()) { try { addDocumentHit(reply); @@ -126,8 +136,6 @@ public class GetSearcher extends Searcher { log.log(LogLevel.DEBUG, "Received error reply with message " + reply.getError(0).getMessage()); } } - - return (numPending > 0); } private void addDocumentHit(Reply reply) { @@ -385,6 +393,7 @@ public class GetSearcher extends Searcher { result.hits().addError(ErrorMessage.createTimeout( "Timed out after waiting "+timeoutMillis+" ms for responses")); } + response.processReplies(); if (fieldName != null) { handleFieldFiltering(response, result, fieldName, contentType, headersOnly); } else { |