aboutsummaryrefslogtreecommitdiffstats
path: root/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/ClientFeederV3.java
diff options
context:
space:
mode:
Diffstat (limited to 'vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/ClientFeederV3.java')
-rw-r--r--vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/ClientFeederV3.java24
1 files changed, 14 insertions, 10 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 d57ef11f2d3..66955be2325 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
@@ -8,6 +8,7 @@ import com.yahoo.documentapi.messagebus.protocol.DocumentMessage;
import com.yahoo.documentapi.messagebus.protocol.DocumentProtocol;
import com.yahoo.jdisc.Metric;
import com.yahoo.jdisc.ReferencedResource;
+import com.yahoo.jdisc.ResourceReference;
import com.yahoo.messagebus.Message;
import com.yahoo.messagebus.ReplyHandler;
import com.yahoo.messagebus.Result;
@@ -71,22 +72,25 @@ class ClientFeederV3 {
this.hostName = HostName.getLocalhost();
}
- public boolean timedOut() {
+ boolean timedOut() {
synchronized (monitor) {
return Instant.now().isAfter(prevOpsPerSecTime.plusSeconds(6000)) && ongoingRequests.get() == 0;
}
}
- public void kill() {
- // No new requests should be sent to this object, but there can be old one, even though this is very unlikely.
- while (ongoingRequests.get() > 0) {
- try {
- ongoingRequests.wait(100);
- } catch (InterruptedException e) {
- break;
+ void kill() {
+ try (ResourceReference ignored = sourceSession.getReference()) {
+ // No new requests should be sent to this object, but there can be old one, even though this is very unlikely.
+ while (ongoingRequests.get() > 0) {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ return;
+ }
}
+ } catch (Exception e) {
+ log.log(Level.WARNING, "Failed to close reference to source session", e);
}
- sourceSession.getReference().close();
}
private void transferPreviousRepliesToResponse(BlockingQueue<OperationStatus> operations) throws InterruptedException {
@@ -98,7 +102,7 @@ class ClientFeederV3 {
}
}
- public HttpResponse handleRequest(HttpRequest request) throws IOException {
+ HttpResponse handleRequest(HttpRequest request) throws IOException {
ongoingRequests.incrementAndGet();
try {
FeederSettings feederSettings = new FeederSettings(request);