From c8a78cb2083cced90b2db6b7056dc61652607ca3 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Tue, 10 Jan 2017 19:16:58 +0100 Subject: 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 --- .../main/java/com/yahoo/storage/searcher/GetSearcher.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'vespaclient-container-plugin') 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 ordering; private List documentHits = new ArrayList<>(); private List errorHits = new ArrayList<>(); + private List replies = new ArrayList<>(); public GetResponse(List 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 { -- cgit v1.2.3