Skip to content
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

Migrate HttpComponentsClientHttpRequestFactory.setReadTimeout to SocketConfig.setSoTimeout #572

Merged
merged 18 commits into from
Aug 15, 2024

Conversation

Laurens-W
Copy link
Contributor

@Laurens-W Laurens-W commented Aug 14, 2024

What's changed?

Added a conservative recipe to migrate from HttpComponentsClientHttpRequestFactory.setReadTimeout to SocketConfig.setSoTimeout.

What's your motivation?

Anything in particular you'd like reviewers to focus on?

Test coverage

Anyone you would like to review specifically?

@timtebeek

Have you considered any alternatives or workarounds?

Any additional context

For now the recipe assumes a PoolingHttpClientConnectionManager is defined within the same class as the HttpComponentsClientHttpRequestFactory. It doesn't take into account that a PoolingHttpClientConnectionManagerBuilder exists nor does it refactor to this.

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@Laurens-W Laurens-W force-pushed the http-component-read-timeout branch from 15ca5be to dae1505 Compare August 14, 2024 15:16
@timtebeek timtebeek changed the title Add recipe for migrating HttpComponentsClientHttpRequestFactory.setReadTimeout to SocketConfig.setSoTimeout Migrate HttpComponentsClientHttpRequestFactory.setReadTimeout to SocketConfig.setSoTimeout Aug 14, 2024
@timtebeek timtebeek added recipe Recipe requested boot-3.0 labels Aug 14, 2024
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So a thing to note here is that these classpath resources end up in the packaged jar we send out to folks ; right now we're adding four jars, together weighing in at 2.8 MB; there's also alternatives that do not require any addition to the classpath for tests:

.dependsOn("package org.junit; public @interface ClassRule {}", "package org.junit; public @interface Rule {}")

Let's strive to be conservative into what we add as jars, and how we add those. Preferably in src/test when we can, and automatically through parserClasspath entries and the ./gradlew downloadRecipeDependencies task, as opposed to manually.

@timtebeek timtebeek marked this pull request as ready for review August 15, 2024 11:52
@timtebeek timtebeek merged commit 729f756 into main Aug 15, 2024
2 checks passed
@timtebeek timtebeek deleted the http-component-read-timeout branch August 15, 2024 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
boot-3.0 recipe Recipe requested
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

HttpComponentsClientHttpRequestFactory.setReadTimeout was removed in Spring 6.1.0
2 participants