diff options
Diffstat (limited to 'configserver/src')
4 files changed, 15 insertions, 34 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelRequestHandler.java b/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelRequestHandler.java index d5f3a237b9d..8458f9f0ddd 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelRequestHandler.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelRequestHandler.java @@ -11,10 +11,8 @@ import com.yahoo.vespa.config.ConfigKey; import com.yahoo.vespa.config.GetConfigRequest; import com.yahoo.vespa.config.protocol.ConfigResponse; import com.yahoo.config.provision.ApplicationId; -import com.yahoo.config.provision.TenantName; import com.yahoo.vespa.config.server.application.ApplicationSet; import com.yahoo.vespa.config.server.rpc.ConfigResponseFactory; -import com.yahoo.vespa.config.server.rpc.ConfigResponseFactoryFactory; import java.io.IOException; import java.util.Optional; @@ -42,7 +40,7 @@ public class SuperModelRequestHandler implements RequestHandler { ConfigserverConfig configserverConfig, SuperModelManager superModelManager) { this.configDefinitionRepo = configDefinitionRepo; - this.responseFactory = ConfigResponseFactoryFactory.createFactory(configserverConfig); + this.responseFactory = ConfigResponseFactory.create(configserverConfig); this.superModelManager = superModelManager; updateHandler(); } diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/ConfigResponseFactory.java b/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/ConfigResponseFactory.java index 2a385a15fb6..54825167d15 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/ConfigResponseFactory.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/ConfigResponseFactory.java @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.config.server.rpc; +import com.yahoo.cloud.config.ConfigserverConfig; import com.yahoo.config.codegen.InnerCNode; import com.yahoo.vespa.config.ConfigPayload; import com.yahoo.vespa.config.protocol.ConfigResponse; @@ -13,6 +14,17 @@ import com.yahoo.vespa.config.protocol.ConfigResponse; */ public interface ConfigResponseFactory { + static ConfigResponseFactory create(ConfigserverConfig configserverConfig) { + switch (configserverConfig.payloadCompressionType()) { + case LZ4: + return new LZ4ConfigResponseFactory(); + case UNCOMPRESSED: + return new UncompressedConfigResponseFactory(); + default: + throw new IllegalArgumentException("Unknown payload compression type " + configserverConfig.payloadCompressionType()); + } + } + /** * Create a {@link ConfigResponse} for a given payload and generation. * diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/ConfigResponseFactoryFactory.java b/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/ConfigResponseFactoryFactory.java deleted file mode 100644 index 4b6330bc003..00000000000 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/ConfigResponseFactoryFactory.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.config.server.rpc; - -import com.yahoo.cloud.config.ConfigserverConfig; -import com.yahoo.vespa.config.server.rpc.ConfigResponseFactory; -import com.yahoo.vespa.config.server.rpc.LZ4ConfigResponseFactory; -import com.yahoo.vespa.config.server.rpc.UncompressedConfigResponseFactory; - -/** - * Logic to select the appropriate response factory based on config. - * TODO: Move this to {@link ConfigResponseFactory} when we have java 8. - * - * @author Ulf Lilleengen - * @since 5.20 - */ -public class ConfigResponseFactoryFactory { - - public static ConfigResponseFactory createFactory(ConfigserverConfig configserverConfig) { - switch (configserverConfig.payloadCompressionType()) { - case LZ4: - return new LZ4ConfigResponseFactory(); - case UNCOMPRESSED: - return new UncompressedConfigResponseFactory(); - default: - throw new IllegalArgumentException("Unknown payload compression type " + configserverConfig.payloadCompressionType()); - } - } - -} diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantBuilder.java b/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantBuilder.java index de44a0328f3..d157d8383ea 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantBuilder.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantBuilder.java @@ -4,7 +4,7 @@ package com.yahoo.vespa.config.server.tenant; import com.yahoo.path.Path; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.TenantName; -import com.yahoo.vespa.config.server.rpc.ConfigResponseFactoryFactory; +import com.yahoo.vespa.config.server.rpc.ConfigResponseFactory; import com.yahoo.vespa.config.server.GlobalComponentRegistry; import com.yahoo.vespa.config.server.host.HostValidator; import com.yahoo.vespa.config.server.ReloadHandler; @@ -131,7 +131,7 @@ public class TenantBuilder { TenantRequestHandler impl = new TenantRequestHandler(componentRegistry.getMetrics(), tenant, Collections.singletonList(componentRegistry.getReloadListener()), - ConfigResponseFactoryFactory.createFactory(componentRegistry.getConfigserverConfig()), + ConfigResponseFactory.create(componentRegistry.getConfigserverConfig()), componentRegistry.getHostRegistries()); if (hostValidator == null) { this.hostValidator = impl; |