hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Non-threadsafe methods in HC 4
Date Tue, 03 Feb 2009 13:49:16 GMT
On Mon, 2009-02-02 at 22:44 +0000, sebb wrote:
> Protocol Interceptors are supposed to be thread-safe.
> 
> However, BasicHttpProcessor is not thread-safe as changes to the Lists
> are not synchronized.
> 
> The rest of the Interceptors have no fields so are immutable. They
> operate on non-thread-safe classes, however I assume that such classes
> are confined to a single thread.
> 
> ==
> 
> SessionRequestImpl is supposed to be thread-safe, however there are
> several mutable fields that are not synch or volatile.
> 
> ==
> 
> Are HttpParams supposed to be shared between threads? The Javadoc say
> that they are intended to be immutable once initialised; however this
> does not guarantee that the values will be visible to all threads.
> 
> BasicHttpParams could be made less thread unsafe by making the map
> final, and clear()ing rather than null-ing it.
> 
> Likewise, if there was a copy constructor, if could save the map
> variable after creating it.
> 

(1) Both BasicHttpParams and BasicHttpProtocols can be shared between
threads but they are expected to be used in the 'write once / read many'
mode. Therefore, access to their internal structures is not synchronized
for performance reason. These classes are not fully thread-safe if
modified at runtime and any statement to the contrary is a mistake in
documentation. 

I suggest we improve the documentation of BasicHttpParams and
BasicHttpProtocols with regards to their intended usage, but will not
make them fully thread-safe. Making those classes less prone to
synchronization issues would also be welcome.

Would that be okay for you? 

(2) I'll review SessionRequestImpl

Oleg

> S///
> 
> ---------------------------------------------------------------------
> 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