diff options
Diffstat (limited to 'vespa-http-client')
3 files changed, 5 insertions, 5 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 d963ae79227..2b746cf56d0 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 @@ -38,10 +38,10 @@ class DocumentQueue { } } - void put(Document document) throws InterruptedException { + void put(Document document, boolean self) throws InterruptedException { document.resetQueueTime(); synchronized (queue) { - while (!closed && queue.size() >= maxSize) { + while (!closed && (queue.size() >= maxSize) && !self) { queue.wait(); } if (closed) { 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 f3cb0b7bcf7..dc753deb9f9 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 @@ -165,7 +165,7 @@ class IOThread implements Runnable, AutoCloseable { public void post(final Document document) throws InterruptedException { - documentQueue.put(document); + documentQueue.put(document, false); } @Override diff --git a/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/communication/CloseableQTestCase.java b/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/communication/CloseableQTestCase.java index 13129dba326..4148e652d55 100644 --- a/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/communication/CloseableQTestCase.java +++ b/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/communication/CloseableQTestCase.java @@ -10,7 +10,7 @@ public class CloseableQTestCase { @Test public void requestThatPutIsInterruptedOnClose() throws InterruptedException { final DocumentQueue q = new DocumentQueue(1); - q.put(new Document("id", "data", null /* context */)); + q.put(new Document("id", "data", null /* context */), false); Thread t = new Thread(new Runnable() { @Override public void run() { @@ -25,7 +25,7 @@ public class CloseableQTestCase { }); t.start(); try { - q.put(new Document("id2", "data2", null /* context */)); + q.put(new Document("id2", "data2", null /* context */), false); fail("This shouldn't have worked."); } catch (IllegalStateException ise) { // ok! |