diff options
author | Jon Bratseth <bratseth@oath.com> | 2018-05-22 12:36:54 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@oath.com> | 2018-05-22 12:36:54 +0200 |
commit | c9bad532ed114e57594f975fdb1f697e4a288910 (patch) | |
tree | 0095e8c08eac1c333f7b4baa601d43718e2f321c /vespaclient-container-plugin/src | |
parent | 1b23e2014d0402b9d3de71c66304878057aec6e4 (diff) |
Iterate over indexes not fields
Diffstat (limited to 'vespaclient-container-plugin/src')
-rw-r--r-- | vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/ClientFeederV3.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/ClientFeederV3.java b/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/ClientFeederV3.java index 5f1c96d000f..835a11bf7c2 100644 --- a/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/ClientFeederV3.java +++ b/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/ClientFeederV3.java @@ -183,9 +183,9 @@ class ClientFeederV3 { if (! operationId.isPresent()) { return Optional.empty(); } - final DocumentOperationMessageV3 msg; + final DocumentOperationMessageV3 message; try { - msg = getNextMessage(operationId.get(), requestInputStream, settings); + message = getNextMessage(operationId.get(), requestInputStream, settings); } catch (Exception e) { if (log.isLoggable(LogLevel.DEBUG)) { log.log(LogLevel.DEBUG, Exceptions.toMessageString(e), e); @@ -195,8 +195,9 @@ class ClientFeederV3 { continue; } - setRoute(msg, settings); - return Optional.of(msg); + if (message != null) + setRoute(message, settings); + return Optional.ofNullable(message); } } @@ -273,6 +274,7 @@ class ClientFeederV3 { } // protected for mocking + /** Returns the next message in the stream, or null if none */ protected DocumentOperationMessageV3 getNextMessage( String operationId, InputStream requestInputStream, FeederSettings settings) throws Exception { VespaXMLFeedReader.Operation operation = streamReaderV3.getNextOperation(requestInputStream, settings); @@ -285,14 +287,14 @@ class ClientFeederV3 { null); } - DocumentOperationMessageV3 msg = DocumentOperationMessageV3.create(operation, operationId, metric); - if (msg == null) { + DocumentOperationMessageV3 message = DocumentOperationMessageV3.create(operation, operationId, metric); + if (message == null) { // typical end of feed return null; } metric.add(MetricNames.NUM_OPERATIONS, 1, null /*metricContext*/); - log(LogLevel.DEBUG, "Successfully deserialized document id: ", msg.getOperationId()); - return msg; + log(LogLevel.DEBUG, "Successfully deserialized document id: ", message.getOperationId()); + return message; } private void setMessageParameters(DocumentOperationMessageV3 msg, FeederSettings settings) { |