@@ -121,28 +121,28 @@ final class S3ClientSettings {
121121    static  final  Setting .AffixSetting <TimeValue > READ_TIMEOUT_SETTING  = Setting .affixKeySetting (
122122        PREFIX ,
123123        "read_timeout" ,
124-         key  -> Setting .timeSetting (key , TimeValue . timeValueMillis ( ClientConfiguration . DEFAULT_SOCKET_TIMEOUT ) , Property .NodeScope )
124+         key  -> Setting .timeSetting (key , Defaults . READ_TIMEOUT , Property .NodeScope )
125125    );
126126
127127    /** The maximum number of concurrent connections to use. */ 
128128    static  final  Setting .AffixSetting <Integer > MAX_CONNECTIONS_SETTING  = Setting .affixKeySetting (
129129        PREFIX ,
130130        "max_connections" ,
131-         key  -> Setting .intSetting (key , ClientConfiguration . DEFAULT_MAX_CONNECTIONS , 1 , Property .NodeScope )
131+         key  -> Setting .intSetting (key , Defaults . MAX_CONNECTIONS , 1 , Property .NodeScope )
132132    );
133133
134134    /** The number of retries to use when an s3 request fails. */ 
135135    static  final  Setting .AffixSetting <Integer > MAX_RETRIES_SETTING  = Setting .affixKeySetting (
136136        PREFIX ,
137137        "max_retries" ,
138-         key  -> Setting .intSetting (key , ClientConfiguration . DEFAULT_RETRY_POLICY . getMaxErrorRetry () , 0 , Property .NodeScope )
138+         key  -> Setting .intSetting (key , Defaults . RETRY_COUNT , 0 , Property .NodeScope )
139139    );
140140
141141    /** Whether retries should be throttled (ie use backoff). */ 
142142    static  final  Setting .AffixSetting <Boolean > USE_THROTTLE_RETRIES_SETTING  = Setting .affixKeySetting (
143143        PREFIX ,
144144        "use_throttle_retries" ,
145-         key  -> Setting .boolSetting (key , ClientConfiguration . DEFAULT_THROTTLE_RETRIES , Property .NodeScope )
145+         key  -> Setting .boolSetting (key , Defaults . THROTTLE_RETRIES , Property .NodeScope )
146146    );
147147
148148    /** Whether the s3 client should use path style access. */ 
@@ -335,7 +335,7 @@ S3ClientSettings refine(Settings repositorySettings) {
335335
336336    /** 
337337     * Load all client settings from the given settings. 
338-      * 
338+      * <p>  
339339     * Note this will always at least return a client named "default". 
340340     */ 
341341    static  Map <String , S3ClientSettings > load (Settings  settings ) {
@@ -501,4 +501,11 @@ private static <T> T getRepoSettingOrDefault(Setting.AffixSetting<T> setting, Se
501501        }
502502        return  defaultValue ;
503503    }
504+ 
505+     static  final  class  Defaults  {
506+         static  final  TimeValue  READ_TIMEOUT  = TimeValue .timeValueMillis (ClientConfiguration .DEFAULT_SOCKET_TIMEOUT );
507+         static  final  int  MAX_CONNECTIONS  = ClientConfiguration .DEFAULT_MAX_CONNECTIONS ;
508+         static  final  int  RETRY_COUNT  = ClientConfiguration .DEFAULT_RETRY_POLICY .getMaxErrorRetry ();
509+         static  final  boolean  THROTTLE_RETRIES  = ClientConfiguration .DEFAULT_THROTTLE_RETRIES ;
510+     }
504511}
0 commit comments