[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-1000?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12913650#action_12913650
 ] 

Michajlo Matijkiw commented on HTTPCLIENT-1000:
-----------------------------------------------

>From what I've gathered from the code, the BasicPoolEntry expiry field is used 
>to close a connection after it has been idle for some time, so as long as a 
>connection is being used its expiry can continuously be pushed back, and the 
>connection will last indefinitely.  I have been looking into redefining the 
>expiry to be the lesser of expiry in its current definition and the time its 
>expiration date based on TTL.  This will bound expiry's growth ensuring that 
>the connection will not last indefinitely.

Could you elaborate more on what adding methods to ManagedClientConnection 
would break?  I have added isExpired to it and implemented it in 
BasicPoolConnAdapter and ConnAdapter and everything appears fine, however, 
there are a lot of things I am unfamiliar with.  The difficulty is that we 
would like to force DefaultRequestDirector to give up a managed connection that 
is expired, but there is no way of figuring it out from there.

On the other hand, perhaps the RequestDirector will let go of requests 
frequently enough that it will not matter?  I am working on better 
understanding how/if DefaultRequestDirector reuses ManagedClientConnections.

Thanks,
Michajlo

> Configure Maximum Connection Lifetimes
> --------------------------------------
>
>                 Key: HTTPCLIENT-1000
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1000
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpClient
>            Reporter: Michajlo Matijkiw
>
> Provide a means of configuring a maximum lifetime for HttpClient connections. 
>  Currently, it would appear as long as a connection is used it may persist 
> indefinitely.
> This would be useful for situations where HttpClient needs to react to DNS 
> changes, such as the following situation that may occur when using DNS load 
> balancing:
>  - HttpClient maintains connections to example.com which resolves to IP A
>  - Machine at IP A fails, and example.com now resolves to backup machine at 
> IP B
>  - Since IP A is failing, connections are destroyed, and new connections are 
> made to IP B
>  - Machine at IP A recovers, but HttpClient maintains connections to IP B 
> since the connections are still healthy
> The desired behavior would be that connections to IP B will reach their 
> connection lifetime, and new connections could be created back to IP A 
> according to the updated DNS settings.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to