hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject BasicHttpParams not thread-safe?
Date Sun, 01 Jun 2008 14:29:44 GMT
It looks like BasicHttpParams is not thread-safe.

Although it uses a HashMap (which is thread-safe) to store parameters,
the instance variable which holds it is not final or volatile, and
accesses to it are not synchronized.

If one thread calls setParameter() and creates the HashMap, there is
no guarantee that another thread will see the HashMap.

One solution would be to always create the HashMap (in the ctor or in
the variable defn).
This would mean some internal changes - e.g. clear() - but are there
any drawbacks to always creating the HashMap?


To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org

View raw message