Closed
Description
RequestBuilder
(RequestBuilderBase
) implements builder pattern to build instances of Request
object. Some issues with it:
RequestBuilder
instance cannot be reused because it holds state forRequest
object instance - this is not even documented;- Traditionally an object built by a builder is immutable and is not connected to it's builder in any way. Built
Request
object is not immutable - can be mutated by the builder even after construction; - Because of the above
Request
object is not threadsafe. It's good to fix that too.
The obvious way to fix that issue is to construct new Request
instances on each build()
and make all it's fields final.
AsyncHttpClientConfig
have the same problem with threadsafety - it have mutable fields. Should be final.