diff options
author | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2018-10-16 21:32:56 +0200 |
---|---|---|
committer | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2018-10-16 21:32:56 +0200 |
commit | 1685b5eff9084ca7da4637432f6c661b7542ddaa (patch) | |
tree | a2b7fbded4b8f5dd5fb487ca9f50217a23794428 /vespa-http-client | |
parent | a81b7fff7f4006ab8fe1b89a0a50d84af734b10f (diff) |
Address review
Diffstat (limited to 'vespa-http-client')
2 files changed, 6 insertions, 6 deletions
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/api/FeedClientImpl.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/api/FeedClientImpl.java index e4a3f91c33e..8a851bb72c0 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/api/FeedClientImpl.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/api/FeedClientImpl.java @@ -60,13 +60,13 @@ public class FeedClientImpl implements FeedClient { @Override public void close() { - Instant lastResultReceived = Instant.now(); + Instant lastOldestResultReceivedAt = Instant.now(); Optional<String> oldestIncompleteId = operationProcessor.oldestIncompleteResultId(); - while (oldestIncompleteId.isPresent() && waitForOperations(lastResultReceived, sleepTimeMs, closeTimeoutMs)) { + while (oldestIncompleteId.isPresent() && waitForOperations(lastOldestResultReceivedAt, sleepTimeMs, closeTimeoutMs)) { Optional<String> oldestIncompleteIdNow = operationProcessor.oldestIncompleteResultId(); if ( ! oldestIncompleteId.equals(oldestIncompleteIdNow)) - lastResultReceived = Instant.now(); + lastOldestResultReceivedAt = Instant.now(); oldestIncompleteId = oldestIncompleteIdNow; } operationProcessor.close(); 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 24f27196394..d300bead9c1 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 @@ -109,9 +109,9 @@ public class OperationProcessor { /** Returns the id of the oldest operation to be sent. */ public Optional<String> oldestIncompleteResultId() { synchronized (monitor) { - return Optional.of(docSendInfoByOperationId.keySet().iterator()) - .filter(Iterator::hasNext) - .map(Iterator::next); + return docSendInfoByOperationId.isEmpty() + ? Optional.empty() + : Optional.of(docSendInfoByOperationId.keySet().iterator().next()); } } |