hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: AbstractConnPool - thread-safety issues
Date Sat, 21 Mar 2009 20:11:46 GMT
sebb wrote:
> I'm still working my way through HC code trying to add the JCIP annotations.
> [Useful for me, as I want to migrate JMeter to HC 4 at some point.]
> 
> I've found what appears to be a problem with AbstractConnPool - the
> refQueue and refWorker fields are not always accessed with the pool
> lock held.
> 
> This is quite tricky to follow currently - and tricky to prove at
> run-time - as the variables are not private.
> 
> I'd like to make all the AbstractConnPool variables private, and add
> protected accessors instead. This would allow one to add debug code to
> check that the variables were only accessed when the correct lock was
> held. Yes, it might be a bit slower, but concurrency issues are
> extremely hard to track down so IMO it would be worth any extra
> overhead.
> 
> Likewise, the protected variables in ConnPoolByRoute could be made
> private, and given protected getters.
> 
> Also, the design of enableConnectionGC() makes it harder to ensure
> thread safety. Would it not be better to add a flag to the
> constructor? The thread would still have to be started separately, but
> it would be a lot easier to ensure thread safety. Perhaps
> enableConnectionGC() could just check that the object was constructed
> with the approriate flag and start the thread; this might simplify
> code changes.
> 

Sebastian,

Most of the connection management code has been written by Roland and I 
simply cannot say why certain design decisions has been made. By all of 
means please do go ahead and make things more thread safe. However, most 
of the changes you are proposing are likely to cause binary 
compatibility issues with the version shipped with Android. We will need 
to communicate those changes to Google so they could properly document 
possible API incompatibilities.

Cheers

Oleg



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


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


Mime
View raw message