Skip to content

Conversation

@steve-aom-elliott
Copy link
Contributor

@steve-aom-elliott steve-aom-elliott commented Jan 28, 2026

Summary

  • Adds recipe to migrate PoolingNHttpClientConnectionManager to PoolingAsyncClientConnectionManager using the builder pattern
  • Adds recipe to fold configuration method calls into the builder chain with proper method name mappings
  • Adds additional migrations for httpcore-nio classes to httpcore5 equivalents
  • Adds warning comments for constructors and classes that require manual migration

Problem

Apache HttpAsyncClient 4.x is deprecated and customers need to migrate to HttpClient 5.x. The PoolingNHttpClientConnectionManager class and related NIO classes have changed significantly in the new version.

Solution

New recipes added:

  • MigratePoolingNHttpClientConnectionManager - Converts constructor calls to use PoolingAsyncClientConnectionManagerBuilder.create().build()
  • UsePoolingAsyncClientConnectionManagerBuilder - Folds subsequent configuration method calls into the builder chain, with method name mappings (e.g., setMaxTotalsetMaxConnTotal)
  • UpgradeApacheHttpClient_5_AsyncClientClassMapping - Orchestrates async client class migrations

Recipes updated:

  • UpgradeApacheHttpCore_5_NioClassMapping - Migrates additional httpcore-nio classes

Test plan

  • Existing tests pass

  • New tests added for MigratePoolingNHttpClientConnectionManager

  • New tests added for UsePoolingAsyncClientConnectionManagerBuilder

  • New tests added for MigrateApacheHttpCoreNioTest

  • Fixes moderneinc/customer-requests#1529

…tConnectionManager` using its builder

Still to do:
- Migrating more complicated constructors
- Handling other classes from the Http Async Client dependency
…nnectionManager` were to call out cases where constructor migration will lose parameters that need to be double checked.

Moving some migrations into the set of HttpCore-Nio class migrations
@steve-aom-elliott steve-aom-elliott force-pushed the steve/1529-apache-http-async-client-migration branch from 0af2eac to 6a385ff Compare January 28, 2026 22:31
@steve-aom-elliott steve-aom-elliott added bug Something isn't working enhancement New feature or request test provided labels Jan 28, 2026
…syncClientConnectionManager` and its builder respectively. Updated `closeIdleConnections(..)` to `closeIdle(..)`
@steve-aom-elliott steve-aom-elliott moved this from In Progress to Ready to Review in OpenRewrite Feb 4, 2026
@steve-aom-elliott steve-aom-elliott marked this pull request as ready for review February 4, 2026 20:04
@jkschneider jkschneider merged commit a0a99a7 into main Feb 4, 2026
2 checks passed
@jkschneider jkschneider deleted the steve/1529-apache-http-async-client-migration branch February 4, 2026 21:09
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request test provided

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants