@@ -65,12 +65,12 @@ public class DockerClientConfig implements Serializable {
6565 private final boolean loggingFilterEnabled ;
6666 private final SSLConfig sslConfig ;
6767
68- private final int maxTotalConnections ;
69- private final int maxPerRouteConnections ;
68+ private final Integer maxTotalConnections ;
69+ private final Integer maxPerRouteConnections ;
7070
7171 DockerClientConfig (URI uri , String version , String username , String password , String email , String serverAddress ,
7272 String dockerCfgPath , Integer readTimeout , boolean loggingFilterEnabled , SSLConfig sslConfig ,
73- int maxTotalConns , int maxPerRouteConns ) {
73+ Integer maxTotalConns , Integer maxPerRouteConns ) {
7474 this .uri = uri ;
7575 this .version = version ;
7676 this .username = username ;
@@ -251,6 +251,14 @@ public String getDockerCfgPath() {
251251 return dockerCfgPath ;
252252 }
253253
254+ public Integer getMaxTotalConnections () {
255+ return maxTotalConnections ;
256+ }
257+
258+ public Integer getMaxPerRoutConnections () {
259+ return maxPerRouteConnections ;
260+ }
261+
254262 private AuthConfig getAuthConfig () {
255263 AuthConfig authConfig = null ;
256264 if (getUsername () != null && getPassword () != null && getEmail () != null
@@ -372,9 +380,15 @@ public DockerClientConfigBuilder withProperties(Properties p) {
372380 .withLoggingFilter (Boolean .valueOf (p .getProperty (DOCKER_IO_ENABLE_LOGGING_FILTER_PROPERTY , "true" )))
373381 .withDockerCertPath (p .getProperty (DOCKER_IO_DOCKER_CERT_PATH_PROPERTY ))
374382 .withDockerCfgPath (p .getProperty (DOCKER_IO_DOCKER_CFG_PATH_PROPERTY ))
375- .withMaxPerRouteConnections (Integer .valueOf (p .getProperty (DOCKER_IO_MAX_PER_ROUTE_PROPERTY , "2" )))
376- .withMaxTotalConnections (Integer .valueOf (p .getProperty (DOCKER_IO_MAX_TOTAL_PROPERTY , "20" )))
377- ;
383+ .withMaxPerRouteConnections (integerValue (p .getProperty (DOCKER_IO_MAX_PER_ROUTE_PROPERTY )))
384+ .withMaxTotalConnections (integerValue (p .getProperty (DOCKER_IO_MAX_TOTAL_PROPERTY )));
385+ }
386+
387+ private Integer integerValue (String value ) {
388+ if (value != null )
389+ return Integer .valueOf (value );
390+ else
391+ return null ;
378392 }
379393
380394 public final DockerClientConfigBuilder withUri (String uri ) {
@@ -462,11 +476,5 @@ public DockerClientConfig build() {
462476 }
463477 }
464478
465- public int getMaxTotalConnections () {
466- return maxTotalConnections ;
467- }
468-
469- public int getMaxPerRoutConnections () {
470- return maxPerRouteConnections ;
471- }
479+ //
472480}
0 commit comments