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. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
