From 53516cdff9b6aea3f1512cc31b34e0593c04deb5 Mon Sep 17 00:00:00 2001 From: elandau Date: Tue, 7 May 2019 16:46:28 -0700 Subject: [PATCH] Add missing default values --- .../client/config/DefaultClientConfigImpl.java | 14 +++++++------- .../client/config/CommonClientConfigKey.java | 15 ++++++++------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/ribbon-archaius/src/main/java/com/netflix/client/config/DefaultClientConfigImpl.java b/ribbon-archaius/src/main/java/com/netflix/client/config/DefaultClientConfigImpl.java index 13186056..3231bdbd 100644 --- a/ribbon-archaius/src/main/java/com/netflix/client/config/DefaultClientConfigImpl.java +++ b/ribbon-archaius/src/main/java/com/netflix/client/config/DefaultClientConfigImpl.java @@ -75,7 +75,7 @@ values are specified in this class as constants. public class DefaultClientConfigImpl extends AbstractReloadableClientConfig { @Deprecated - public static final Boolean DEFAULT_PRIORITIZE_VIP_ADDRESS_BASED_SERVERS = Boolean.TRUE; + public static final Boolean DEFAULT_PRIORITIZE_VIP_ADDRESS_BASED_SERVERS = CommonClientConfigKey.PrioritizeVipAddressBasedServers.defaultValue(); @Deprecated public static final String DEFAULT_NFLOADBALANCER_PING_CLASSNAME = CommonClientConfigKey.NFLoadBalancerPingClassName.defaultValue(); @@ -174,10 +174,10 @@ public class DefaultClientConfigImpl extends AbstractReloadableClientConfig { public static final String DEFAULT_SERVER_LIST_UPDATER_CLASS = CommonClientConfigKey.ServerListUpdaterClassName.defaultValue(); @Deprecated - public static final int DEFAULT_CONNECTION_IDLE_TIMERTASK_REPEAT_IN_MSECS = 30000; // every half minute (30 secs) + public static final int DEFAULT_CONNECTION_IDLE_TIMERTASK_REPEAT_IN_MSECS = CommonClientConfigKey.ConnectionCleanerRepeatInterval.defaultValue(); // every half minute (30 secs) @Deprecated - public static final int DEFAULT_CONNECTIONIDLE_TIME_IN_MSECS = 30000; // all connections idle for 30 secs + public static final int DEFAULT_CONNECTIONIDLE_TIME_IN_MSECS = CommonClientConfigKey.ConnIdleEvictTimeMilliSeconds.defaultValue(); // all connections idle for 30 secs private VipAddressResolver resolver = null; @@ -186,16 +186,16 @@ public class DefaultClientConfigImpl extends AbstractReloadableClientConfig { * calls */ @Deprecated - public static final int DEFAULT_POOL_MAX_THREADS = DEFAULT_MAX_TOTAL_HTTP_CONNECTIONS; + public static final int DEFAULT_POOL_MAX_THREADS = CommonClientConfigKey.MaxTotalHttpConnections.defaultValue(); @Deprecated - public static final int DEFAULT_POOL_MIN_THREADS = 1; + public static final int DEFAULT_POOL_MIN_THREADS = CommonClientConfigKey.PoolMinThreads.defaultValue(); @Deprecated - public static final long DEFAULT_POOL_KEEP_ALIVE_TIME = 15 * 60L; + public static final long DEFAULT_POOL_KEEP_ALIVE_TIME = CommonClientConfigKey.PoolKeepAliveTime.defaultValue(); @Deprecated - public static final TimeUnit DEFAULT_POOL_KEEP_ALIVE_TIME_UNITS = TimeUnit.SECONDS; + public static final TimeUnit DEFAULT_POOL_KEEP_ALIVE_TIME_UNITS = TimeUnit.valueOf(CommonClientConfigKey.PoolKeepAliveTimeUnits.defaultValue()); @Deprecated public static final Boolean DEFAULT_ENABLE_ZONE_AFFINITY = CommonClientConfigKey.EnableZoneAffinity.defaultValue(); diff --git a/ribbon-core/src/main/java/com/netflix/client/config/CommonClientConfigKey.java b/ribbon-core/src/main/java/com/netflix/client/config/CommonClientConfigKey.java index e2dac591..8e272006 100644 --- a/ribbon-core/src/main/java/com/netflix/client/config/CommonClientConfigKey.java +++ b/ribbon-core/src/main/java/com/netflix/client/config/CommonClientConfigKey.java @@ -25,6 +25,7 @@ import java.lang.reflect.Type; import java.util.HashSet; import java.util.Set; +import java.util.concurrent.TimeUnit; import static com.google.common.base.Preconditions.checkArgument; @@ -68,13 +69,13 @@ public abstract class CommonClientConfigKey implements IClientConfigKey { public static final IClientConfigKey PrimeConnectionsURI = new CommonClientConfigKey("PrimeConnectionsURI", "/"){}; - public static final IClientConfigKey PoolMaxThreads = new CommonClientConfigKey("PoolMaxThreads"){}; + public static final IClientConfigKey PoolMaxThreads = new CommonClientConfigKey("PoolMaxThreads", 200){}; - public static final IClientConfigKey PoolMinThreads = new CommonClientConfigKey("PoolMinThreads"){}; + public static final IClientConfigKey PoolMinThreads = new CommonClientConfigKey("PoolMinThreads", 1){}; - public static final IClientConfigKey PoolKeepAliveTime = new CommonClientConfigKey("PoolKeepAliveTime"){}; + public static final IClientConfigKey PoolKeepAliveTime = new CommonClientConfigKey("PoolKeepAliveTime", 15 * 60){}; - public static final IClientConfigKey PoolKeepAliveTimeUnits = new CommonClientConfigKey("PoolKeepAliveTimeUnits"){}; + public static final IClientConfigKey PoolKeepAliveTimeUnits = new CommonClientConfigKey("PoolKeepAliveTimeUnits", TimeUnit.SECONDS.toString()){}; public static final IClientConfigKey EnableConnectionPool = new CommonClientConfigKey("EnableConnectionPool", true) {}; @@ -135,7 +136,7 @@ public abstract class CommonClientConfigKey implements IClientConfigKey { public static final IClientConfigKey TrustStorePassword = new CommonClientConfigKey("TrustStorePassword"){}; // if this is a secure rest client, must we use client auth too? - public static final IClientConfigKey IsClientAuthRequired = new CommonClientConfigKey("IsClientAuthRequired"){}; + public static final IClientConfigKey IsClientAuthRequired = new CommonClientConfigKey("IsClientAuthRequired", false){}; public static final IClientConfigKey CustomSSLSocketFactoryClassName = new CommonClientConfigKey("CustomSSLSocketFactoryClassName"){}; // must host name match name in certificate? @@ -180,7 +181,7 @@ public abstract class CommonClientConfigKey implements IClientConfigKey { public static final IClientConfigKey EnableZoneExclusivity = new CommonClientConfigKey("EnableZoneExclusivity", false){}; - public static final IClientConfigKey PrioritizeVipAddressBasedServers = new CommonClientConfigKey("PrioritizeVipAddressBasedServers"){}; + public static final IClientConfigKey PrioritizeVipAddressBasedServers = new CommonClientConfigKey("PrioritizeVipAddressBasedServers", true){}; public static final IClientConfigKey VipAddressResolverClassName = new CommonClientConfigKey("VipAddressResolverClassName", "com.netflix.client.SimpleVipAddressResolver"){}; @@ -192,7 +193,7 @@ public abstract class CommonClientConfigKey implements IClientConfigKey { public static final IClientConfigKey UseIPAddrForServer = new CommonClientConfigKey("UseIPAddrForServer", false) {}; - public static final IClientConfigKey ListOfServers = new CommonClientConfigKey("listOfServers") {}; + public static final IClientConfigKey ListOfServers = new CommonClientConfigKey("listOfServers", "") {}; private static final Set keys = new HashSet();