summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjonmv <venstad@gmail.com>2024-05-28 16:50:56 +0200
committerjonmv <venstad@gmail.com>2024-05-28 16:50:56 +0200
commit1a98a1376dddbf560bb0a5b6b8653cd64116d7f0 (patch)
tree6e4b4434915320bf937bfea3236b35bb547ff293
parent19ea3d77e8cb11a2a94718eda0e3d3890ced2eff (diff)
Log when replacing HTTP client
-rw-r--r--vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpRequestStrategy.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpRequestStrategy.java b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpRequestStrategy.java
index 63d061d85d3..42079718115 100644
--- a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpRequestStrategy.java
+++ b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpRequestStrategy.java
@@ -36,6 +36,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.logging.Level.FINE;
import static java.util.logging.Level.FINER;
import static java.util.logging.Level.FINEST;
+import static java.util.logging.Level.INFO;
import static java.util.logging.Level.SEVERE;
import static java.util.logging.Level.WARNING;
@@ -346,13 +347,15 @@ class HttpRequestStrategy implements RequestStrategy {
public void dispatch(HttpRequest request, CompletableFuture<HttpResponse> vessel) {
synchronized (monitor) {
AtomicLong usedCounter = inflight;
- Cluster usedCluster = delegate;
usedCounter.incrementAndGet();
- delegate.dispatch(request, vessel);
+ Cluster usedCluster = delegate;
+ usedCluster.dispatch(request, vessel);
vessel.whenComplete((__, ___) -> {
synchronized (monitor) {
- if (usedCounter.decrementAndGet() == 0 && usedCluster != delegate)
+ if (usedCounter.decrementAndGet() == 0 && usedCluster != delegate) {
+ log.log(INFO, "Closing old HTTP client");
usedCluster.close();
+ }
}
});
}
@@ -372,6 +375,7 @@ class HttpRequestStrategy implements RequestStrategy {
void reset() throws IOException {
synchronized (monitor) {
+ log.log(INFO, "Replacing underlying HTTP client to attempt recovery");
delegate = clusterFactory.create();
inflight = new AtomicLong(0);
}