eed3si9n/scalaxb — pull request #279 by rubbish (2014-09-29 18:44:21+00:00)
Title: using lazy val http for async so can be overridden

We're overriding the `dispatch.Http` so that we can give it different configuration (request/connection timeouts, user agents, etc). However, we noticed that we were generating many threads from many different netty `NioWorker`s. Looking into it more, it turns out each `AsyncHttpClientConfig.Builder` spawns a thread pool of these. And looking at our heap dumps, we found that there are many `AsyncHttpClientConfig.Builder`s within the heap.

Anyways, we found out that due to the scala trait initialization order, the `scalaxb.DispatchHttpClient` was always initializing a new Http even though we were overriding it. So by making it a lazy val, we can safely override it without worrying about it getting initialized.