diff options
-rw-r--r-- | vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpFeedClient.java | 13 |
1 files changed, 12 insertions, 1 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 730d9787735..c2181821de6 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 @@ -23,6 +23,7 @@ import java.time.Duration; import java.time.Instant; import java.util.HashMap; import java.util.Map; +import java.util.Optional; import java.util.StringJoiner; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; @@ -54,7 +55,8 @@ class HttpFeedClient implements FeedClient { private final boolean speedTest; HttpFeedClient(FeedClientBuilderImpl builder) throws IOException { - this(builder, builder.dryrun ? new DryrunCluster() : new ApacheCluster(builder)); + this(builder, builder.dryrun ? + new DryrunCluster() : experimentalClientEnabled() ? new JettyCluster(builder) : new ApacheCluster(builder)); } HttpFeedClient(FeedClientBuilderImpl builder, Cluster cluster) { @@ -313,4 +315,13 @@ class HttpFeedClient implements FeedClient { return query.toString(); } + private static boolean experimentalClientEnabled() { + String name = "VESPA_FEED_EXPERIMENTAL_CLIENT"; + return Optional.ofNullable(System.getenv(name)) + .map(Boolean::parseBoolean) + .orElse(Optional.ofNullable(System.getProperty(name)) + .map(Boolean::parseBoolean) + .orElse(false)); + } + } |