summaryrefslogtreecommitdiffstats
path: root/vespa-http-client
diff options
context:
space:
mode:
authorHaakon Dybdahl <dybdahl@yahoo-inc.com>2016-10-24 14:29:36 +0200
committerHaakon Dybdahl <dybdahl@yahoo-inc.com>2016-10-24 14:29:36 +0200
commitf1cd56f44090d50ddcc97fdd3df64312ae1ba565 (patch)
tree81341d5e417823cc972e92db516fbb4c2cb097c8 /vespa-http-client
parentf4569d65f66d2f86048ad68311aa29a4bfddad8d (diff)
Minor improvements.
Diffstat (limited to 'vespa-http-client')
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/DocumentQueue.java2
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/IOThread.java8
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/EndPointResultFactory.java4
3 files changed, 6 insertions, 8 deletions
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/DocumentQueue.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/DocumentQueue.java
index 6462ee1b2cd..cefa8d6e94a 100644
--- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/DocumentQueue.java
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/DocumentQueue.java
@@ -52,9 +52,9 @@ class DocumentQueue {
Document poll(long timeout, TimeUnit unit) throws InterruptedException {
synchronized (queue) {
- long startTime = System.currentTimeMillis();
long remainingToWait = unit.toMillis(timeout);
while (queue.isEmpty()) {
+ long startTime = System.currentTimeMillis();
queue.wait(remainingToWait);
remainingToWait -= (System.currentTimeMillis() - startTime);
if (remainingToWait <= 0) {
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/IOThread.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/IOThread.java
index ce86d9ce043..facf29d245c 100644
--- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/IOThread.java
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/IOThread.java
@@ -271,7 +271,7 @@ class IOThread implements Runnable, AutoCloseable {
pendingDocumentStatusCount.set(pendingResultQueueSize);
List<Document> nextDocsForFeeding = (pendingResultQueueSize > maxInFlightRequests)
- ? new ArrayList<>() // The queue is full, not more documents.
+ ? new ArrayList<>() // The queue is full, will not send more documents.
: getNextDocsForFeeding(maxWaitTimeMilliSecs, TimeUnit.MILLISECONDS);
@@ -282,11 +282,9 @@ class IOThread implements Runnable, AutoCloseable {
}
log.finest("Awaiting " + pendingResultQueueSize + " results.");
ProcessResponse processResponse = feedDocumentAndProcessResults(nextDocsForFeeding);
- if (pendingResultQueueSize > maxInFlightRequests &&
- processResponse.processResultsCount == 0 &&
- nextDocsForFeeding.size() == 0) {
+ if (pendingResultQueueSize > maxInFlightRequests && processResponse.processResultsCount == 0) {
try {
- // Max outstanding documents operation, nothing has been ready on server side, wait a bit
+ // Max outstanding document operations, no more results on server side, wait a bit
// before asking again.
Thread.sleep(300);
} catch (InterruptedException e) {
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/EndPointResultFactory.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/EndPointResultFactory.java
index 296a2c2015f..a91e170fbd5 100644
--- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/EndPointResultFactory.java
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/EndPointResultFactory.java
@@ -73,8 +73,8 @@ public final class EndPointResultFactory {
reply.errorCode.isTransient(),
reply.traceMessage,
exception));
- } catch (Exception e) {
- throw new IllegalArgumentException("Bad result line from server: '" + line + "'", e);
+ } catch (Throwable t) {
+ throw new IllegalArgumentException("Bad result line from server: '" + line + "'", t);
}
}