Oleg Kalnichevski updated HTTPCORE-469:
           Labels: stuck volunteers-wanted  (was: )
    Fix Version/s: Future

I looked at the possibility of replacing {{ReentrantLock}} with 
{{ReentrantReadWriteLock}}. Most of connection pool methods would require write 
access. Only very few methods could be potentially considered read-only and 
would benefit from a separate read lock. I also suspect write lock acquisition 
with {{ReentrantReadWriteLock}} might be somewhat more expensive than with 
{{ReentrantLock}} thus making the pool slower when leasing / releasing 

I am more inclined to put my efforts into HTTPCORE-390. Unless someone else 
steps in and volunteers to do the necessary research and development I am 
leaning toward closing this issue as WONTFIX.


> Use ReentrantReadWriteLock in AbstractConnPool
> ----------------------------------------------
>                 Key: HTTPCORE-469
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-469
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>          Components: HttpCore
>            Reporter: Matt Nelson
>            Assignee: Oleg Kalnichevski
>            Priority: Minor
>              Labels: stuck, volunteers-wanted
>             Fix For: Future
> AbstractConnPool is currently using a {{ReentrantLock}} which has to lock for 
> read and write operations. Switching to {{ReentrantReadWriteLock}}[1] and 
> read locks for the stats/getters methods would reduce the possibility for 
> instrumentation[1] to cause contention. Another option would be 
> {{StampedLock}}[3] if the compile target is 1.8.
> [1] 
> https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/ReentrantReadWriteLock.html
> [2] 
> https://github.com/dropwizard/metrics/blob/v3.2.2/metrics-httpclient/src/main/java/com/codahale/metrics/httpclient/InstrumentedHttpClientConnectionManager.java#L63-L95
> [3] 
> https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/StampedLock.html

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to