gnodet commented on PR #30505:
URL: https://github.com/apache/camel/pull/30505#issuecomment-7096823298

   Good catch on all three points, @davsclaus. Here's what was changed:
   
   **1. The bare `HttpClientBuilder.create()` → 
`clientBuilder.setConnectionManagerShared(true); clientBuilder.build()`**
   
   You're right that `HttpClientBuilder.create().build()` created a bare token 
client that lost the endpoint's TLS, proxy, timeouts, and redirect policy. The 
correct fix is to build from the endpoint's builder (so all configuration is 
inherited) but mark the connection manager as shared first, so the token client 
doesn't consider itself the owner:
   
   ```java
   clientBuilder.setConnectionManagerShared(true);
   this.httpClient = clientBuilder.build();
   ```
   
   `HttpEndpoint.doStop()` already closes the connection manager explicitly 
when it's the endpoint's own (non-component) manager, so 
`connManagerShared=true` on both clients is intentional and correct.
   
   **2. The JIRA reproducer / test validity**
   
   Verified: `tokenAndApiOnSameHostSucceeds` does **not** fail without the fix 
— the test doesn't trigger a stop/restart cycle, so the token client's 
`doStop()` never runs. The correct regression test is 
`tokenClientCloseDoesNotShutDownEndpointPool`, which simulates the lifecycle 
(applies configurer → builds endpoint client → stops configurer → verifies pool 
is usable). That test fails with `IllegalStateException: Connection pool shut 
down` without the fix, and passes with it.
   
   **3. try/finally around the lease**
   
   Done — added.
   
   _Claude Sonnet 4.6 on behalf of gnodet_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to