Ejemplo n.º 1
0
 public DefaultClientConfigImpl withProperty(IClientConfigKey key, Object value) {
   setProperty(key, value);
   return this;
 }
Ejemplo n.º 2
0
 public void loadDefaultValues() {
   putDefaultIntegerProperty(
       CommonClientConfigKey.MaxHttpConnectionsPerHost, getDefaultMaxHttpConnectionsPerHost());
   putDefaultIntegerProperty(
       CommonClientConfigKey.MaxTotalHttpConnections, getDefaultMaxTotalHttpConnections());
   putDefaultBooleanProperty(
       CommonClientConfigKey.EnableConnectionPool, getDefaultEnableConnectionPool());
   putDefaultIntegerProperty(
       CommonClientConfigKey.MaxConnectionsPerHost, getDefaultMaxConnectionsPerHost());
   putDefaultIntegerProperty(
       CommonClientConfigKey.MaxTotalConnections, getDefaultMaxTotalConnections());
   putDefaultIntegerProperty(CommonClientConfigKey.ConnectTimeout, getDefaultConnectTimeout());
   putDefaultIntegerProperty(
       CommonClientConfigKey.ConnectionManagerTimeout, getDefaultConnectionManagerTimeout());
   putDefaultIntegerProperty(CommonClientConfigKey.ReadTimeout, getDefaultReadTimeout());
   putDefaultIntegerProperty(CommonClientConfigKey.MaxAutoRetries, getDefaultMaxAutoRetries());
   putDefaultIntegerProperty(
       CommonClientConfigKey.MaxAutoRetriesNextServer, getDefaultMaxAutoRetriesNextServer());
   putDefaultBooleanProperty(
       CommonClientConfigKey.OkToRetryOnAllOperations, getDefaultOkToRetryOnAllOperations());
   putDefaultBooleanProperty(CommonClientConfigKey.FollowRedirects, getDefaultFollowRedirects());
   putDefaultBooleanProperty(
       CommonClientConfigKey.ConnectionPoolCleanerTaskEnabled,
       getDefaultConnectionPoolCleanerTaskEnabled());
   putDefaultIntegerProperty(
       CommonClientConfigKey.ConnIdleEvictTimeMilliSeconds, getDefaultConnectionidleTimeInMsecs());
   putDefaultIntegerProperty(
       CommonClientConfigKey.ConnectionCleanerRepeatInterval,
       getDefaultConnectionIdleTimertaskRepeatInMsecs());
   putDefaultBooleanProperty(
       CommonClientConfigKey.EnableGZIPContentEncodingFilter,
       getDefaultEnableGzipContentEncodingFilter());
   String proxyHost =
       ConfigurationManager.getConfigInstance()
           .getString(getDefaultPropName(CommonClientConfigKey.ProxyHost.key()));
   if (proxyHost != null && proxyHost.length() > 0) {
     setProperty(CommonClientConfigKey.ProxyHost, proxyHost);
   }
   Integer proxyPort =
       ConfigurationManager.getConfigInstance()
           .getInteger(
               getDefaultPropName(CommonClientConfigKey.ProxyPort),
               (Integer.MIN_VALUE + 1)); // + 1 just to avoid potential clash with user setting
   if (proxyPort != (Integer.MIN_VALUE + 1)) {
     setProperty(CommonClientConfigKey.ProxyPort, proxyPort);
   }
   putDefaultIntegerProperty(CommonClientConfigKey.Port, getDefaultPort());
   putDefaultBooleanProperty(
       CommonClientConfigKey.EnablePrimeConnections, getDefaultEnablePrimeConnections());
   putDefaultIntegerProperty(
       CommonClientConfigKey.MaxRetriesPerServerPrimeConnection,
       getDefaultMaxRetriesPerServerPrimeConnection());
   putDefaultIntegerProperty(
       CommonClientConfigKey.MaxTotalTimeToPrimeConnections,
       getDefaultMaxTotalTimeToPrimeConnections());
   putDefaultStringProperty(
       CommonClientConfigKey.PrimeConnectionsURI, getDefaultPrimeConnectionsUri());
   putDefaultIntegerProperty(CommonClientConfigKey.PoolMinThreads, getDefaultPoolMinThreads());
   putDefaultIntegerProperty(CommonClientConfigKey.PoolMaxThreads, getDefaultPoolMaxThreads());
   putDefaultLongProperty(CommonClientConfigKey.PoolKeepAliveTime, getDefaultPoolKeepAliveTime());
   putDefaultTimeUnitProperty(
       CommonClientConfigKey.PoolKeepAliveTimeUnits, getDefaultPoolKeepAliveTimeUnits());
   putDefaultBooleanProperty(
       CommonClientConfigKey.EnableZoneAffinity, getDefaultEnableZoneAffinity());
   putDefaultBooleanProperty(
       CommonClientConfigKey.EnableZoneExclusivity, getDefaultEnableZoneExclusivity());
   putDefaultStringProperty(CommonClientConfigKey.ClientClassName, getDefaultClientClassname());
   putDefaultStringProperty(
       CommonClientConfigKey.NFLoadBalancerClassName, getDefaultNfloadbalancerClassname());
   putDefaultStringProperty(
       CommonClientConfigKey.NFLoadBalancerRuleClassName, getDefaultNfloadbalancerRuleClassname());
   putDefaultStringProperty(
       CommonClientConfigKey.NFLoadBalancerPingClassName, getDefaultNfloadbalancerPingClassname());
   putDefaultBooleanProperty(
       CommonClientConfigKey.PrioritizeVipAddressBasedServers,
       getDefaultPrioritizeVipAddressBasedServers());
   putDefaultFloatProperty(
       CommonClientConfigKey.MinPrimeConnectionsRatio, getDefaultMinPrimeConnectionsRatio());
   putDefaultStringProperty(
       CommonClientConfigKey.PrimeConnectionsClassName, getDefaultPrimeConnectionsClass());
   putDefaultStringProperty(
       CommonClientConfigKey.NIWSServerListClassName, getDefaultSeverListClass());
   putDefaultStringProperty(
       CommonClientConfigKey.VipAddressResolverClassName, getDefaultVipaddressResolverClassname());
   putDefaultBooleanProperty(
       CommonClientConfigKey.IsClientAuthRequired, getDefaultIsClientAuthRequired());
   // putDefaultStringProperty(CommonClientConfigKey.RequestIdHeaderName,
   // getDefaultRequestIdHeaderName());
   putDefaultBooleanProperty(
       CommonClientConfigKey.UseIPAddrForServer, getDefaultUseIpAddressForServer());
   putDefaultStringProperty(CommonClientConfigKey.ListOfServers, "");
 }