lightbody/browsermob-proxy — pull request #126 by jekh (2014-11-04 18:28:41+00:00)
Title: Synchronization cleanup

In my use of the proxy, I'm serving a fairly large number of requests simultaneously (several thousand, via Selenium). I started to notice some overhead from synchronization, so I decided to undertake a cleanup of synchronization-related code. This is a large changeset, so I've been testing extensively and have not yet seen any problems -- but I would appreciate feedback on other high-volume scenarios to test.

Summary of changes:
- Synchronization updates:
- Moved to java.util.concurrent collections if it allowed removing synchronized blocks. Almost all synchronization blocks are now gone, and there should be no synchronization when serving requests.
- Refactored WhitelistEntry into immutable Whitelist to avoid synchronizing on the WhitelistEntry
- Made fields in BrowserMobHttpClient volatile, since they can be set asynchronously through web service calls.
- Made immutable fields in BrowserMobHttpClient final
- Made UA Detector initialize-on-demand, to avoid resource use and log pollution when not using it. Updated pom latest version of UA Detector.
- Fixed minor defect where calling stop() would not prevent proxy server from handling new requests