-
Notifications
You must be signed in to change notification settings - Fork 41.7k
Add duration support for setConnectTimeout and setReadTimeout #13355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Maybe |
|
@nosan please do not use this issue to discuss something totally unrelated. We're on gitter if you want to chat. Or you can create another issue. |
|
@snicoll Got it, sorry about that. |
snicoll
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. I've made a few comments and welcome your thoughts on it.
I really prefer a dedicated PR to focus on the task at hand. We also welcome "polish" PR that improve code structure, fix typo, etc.
|
|
||
| private final String rootUri; | ||
|
|
||
| private final Duration readTimeout; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not what I have in mind, please keep your change to a minimum. I expect two new methods passing a Duration to the existing customizers with the deprecated methods delegating to them.
| * {@link ClientHttpRequestFactory}. | ||
| * @param connectTimeout the connect timeout in milliseconds | ||
| * @return a new builder instance. | ||
| * @deprecated Deprecated in favor of {@link #setConnectTimeout(Duration)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The format we use is @deprecated since 2.1.0 in favour of {@link #setConnectTimeout(Duration)}.
| } | ||
|
|
||
| /** | ||
| * Sets the connection timeout on the underlying {@link ClientHttpRequestFactory}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd put the method taking Duration above the deprecated one, not below.
| public class HttpWebServiceMessageSenderBuilder { | ||
|
|
||
| private Integer connectionTimeout; | ||
| private Duration connectTimeout; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I've polished the wrong name in 93396ae please rebase and push force an update.
|
|
||
| @Test | ||
| @SuppressWarnings("deprecation") | ||
| public void nullReadTimeoutShouldNotAppliedIgnorePreviousSettings() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those two tests are new right? You could do the same with one that takes a Duration and one that takes null afteR. No need for the deprecation. Besides, I'd appreciate a separate PR for this as they are unrelated.
|
@snicoll Thank you. P.S. With the current implementation this test doesn't work. |
6bf173d to
f1e38fc
Compare
`setConnectTimeout(Duration)`
f1e38fc to
a9b8404
Compare
RestTemplateBuilder HttpWebServiceMessageSenderBuilderRestTemplateBuilder
RestTemplateBuilder* pr/13355: Polish "Add duration support for setConnectTimeout and setReadTimeout" Add duration support for setConnectTimeout and setReadTimeout Polish "Add duration support for setConnectTimout and setReadTimeout"
this PR provides new methods
setConnectTimeout(Duration)andsetReadTimeout(Duration)forRestTemplateBuilder.