From e6f6e83c395d6f0142b45a493237241ba6fcb29b Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 13 Jul 2016 11:17:59 -0700 Subject: [PATCH] Polish --- .../boot/web/client/RestTemplateBuilder.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java b/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java index 9b96e61db1..c7b7d4b84d 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java @@ -520,20 +520,26 @@ public class RestTemplateBuilder { return Collections.unmodifiableSet(result); } + /** + * Strategy interface used to customize the {@link ClientHttpRequestFactory}. + */ private interface RequestFactoryCustomizer { void customize(ClientHttpRequestFactory factory); } - private static abstract class TimeoutConfiguringRequestFactoryCustomizer + /** + * {@link RequestFactoryCustomizer} to call a "set timeout" method. + */ + private static abstract class TimeoutRequestFactoryCustomizer implements RequestFactoryCustomizer { private final int timeout; private final String methodName; - TimeoutConfiguringRequestFactoryCustomizer(int timeout, String methodName) { + TimeoutRequestFactoryCustomizer(int timeout, String methodName) { this.timeout = timeout; this.methodName = methodName; } @@ -555,8 +561,11 @@ public class RestTemplateBuilder { } + /** + * {@link RequestFactoryCustomizer} to set the read timeout. + */ private static class ReadTimeoutRequestFactoryCustomizer - extends TimeoutConfiguringRequestFactoryCustomizer { + extends TimeoutRequestFactoryCustomizer { ReadTimeoutRequestFactoryCustomizer(int readTimeout) { super(readTimeout, "setReadTimeout"); @@ -564,8 +573,11 @@ public class RestTemplateBuilder { } + /** + * {@link RequestFactoryCustomizer} to set the connect timeout. + */ private static class ConnectTimeoutRequestFactoryCustomizer - extends TimeoutConfiguringRequestFactoryCustomizer { + extends TimeoutRequestFactoryCustomizer { ConnectTimeoutRequestFactoryCustomizer(int connectTimeout) { super(connectTimeout, "setConnectTimeout");