summaryrefslogtreecommitdiffstats
path: root/vespa-http-client
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2019-01-16 22:58:35 +0100
committerJon Bratseth <bratseth@verizonmedia.com>2019-01-23 21:41:11 +0100
commita1c2c50005d9cc1978d29765b94be1d082a9601c (patch)
tree007ecaca884f157ec9dd0d01d020cb954f736f06 /vespa-http-client
parent0918be902db32b949e30bc3b5af56173db3283e6 (diff)
Handle multiple results per document in a sync batch
Diffstat (limited to 'vespa-http-client')
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/SyncFeedClient.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/SyncFeedClient.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/SyncFeedClient.java
index c2d237d63af..c1e7f9f04c5 100644
--- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/SyncFeedClient.java
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/SyncFeedClient.java
@@ -123,6 +123,23 @@ public class SyncFeedClient implements AutoCloseable {
*/
private LinkedHashMap<String, Result> results = null;
+ void resetExpectedResults() {
+ synchronized (monitor) {
+ if (results != null)
+ throw new ConcurrentModificationException("A SyncFeedClient instance is used by multiple threads");
+
+ resultsReceived = 0;
+ exception = null;
+ results = new LinkedHashMap<>();
+ }
+ }
+
+ void addExpectationOfResultFor(String operationId) {
+ synchronized (monitor) {
+ results.put(operationId, null);
+ }
+ }
+
void expectResultsOf(List<SyncOperation> operations) {
synchronized (monitor) {
if (results != null)