diff options
Diffstat (limited to 'vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpFeedClient.java')
-rw-r--r-- | vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpFeedClient.java | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpFeedClient.java b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpFeedClient.java index d12d72f7a70..5eb611160cc 100644 --- a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpFeedClient.java +++ b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpFeedClient.java @@ -17,7 +17,6 @@ import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.core.StreamReadConstraints; import java.io.IOException; -import java.io.UncheckedIOException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.time.Duration; @@ -57,19 +56,18 @@ class HttpFeedClient implements FeedClient { private final boolean speedTest; HttpFeedClient(FeedClientBuilderImpl builder) throws IOException { - this(builder, - builder.dryrun ? () -> new DryrunCluster() : () -> new JettyCluster(builder)); + this(builder, builder.dryrun ? new DryrunCluster() : new JettyCluster(builder)); } - HttpFeedClient(FeedClientBuilderImpl builder, ClusterFactory clusterFactory) throws IOException { - this(builder, clusterFactory, new HttpRequestStrategy(builder, clusterFactory)); + HttpFeedClient(FeedClientBuilderImpl builder, Cluster cluster) { + this(builder, cluster, new HttpRequestStrategy(builder, cluster)); } - HttpFeedClient(FeedClientBuilderImpl builder, ClusterFactory clusterFactory, RequestStrategy requestStrategy) throws IOException { + HttpFeedClient(FeedClientBuilderImpl builder, Cluster cluster, RequestStrategy requestStrategy) { this.requestHeaders = new HashMap<>(builder.requestHeaders); this.requestStrategy = requestStrategy; this.speedTest = builder.speedTest; - verifyConnection(builder, clusterFactory); + verifyConnection(builder, cluster); } @Override @@ -133,9 +131,9 @@ class HttpFeedClient implements FeedClient { return promise; } - private void verifyConnection(FeedClientBuilderImpl builder, ClusterFactory clusterFactory) throws IOException { + private void verifyConnection(FeedClientBuilderImpl builder, Cluster cluster) { Instant start = Instant.now(); - try (Cluster cluster = clusterFactory.create()) { + try { HttpRequest request = new HttpRequest("POST", getPath(DocumentId.of("feeder", "handshake", "dummy")) + getQuery(empty(), true), requestHeaders, @@ -319,11 +317,4 @@ class HttpFeedClient implements FeedClient { return query.toString(); } - /** Factory for creating a new {@link Cluster} to dispatch operations to. Used for resetting the active cluster. */ - interface ClusterFactory { - - Cluster create() throws IOException; - - } - } |