You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by bu...@apache.org on 2004/10/13 00:46:26 UTC
DO NOT REPLY [Bug 31680] New: -
DefaultHttpParamsFactory.getDefaultParams() is not thread safe
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=31680>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=31680
DefaultHttpParamsFactory.getDefaultParams() is not thread safe
Summary: DefaultHttpParamsFactory.getDefaultParams() is not
thread safe
Product: HttpClient
Version: 3.0 Alpha 2
Platform: All
OS/Version: Other
Status: NEW
Severity: Normal
Priority: Other
Component: Commons HttpClient
AssignedTo: commons-httpclient-dev@jakarta.apache.org
ReportedBy: bipponobungus@hotmail.com
The method getDefaultParams() in
org.apache.commons.httpclient.params.DefaultHttpParamsFactory is not thread
safe. In this code:
public HttpParams getDefaultParams() {
if (httpParams == null) {
httpParams = createParams();
}
return httpParams;
}
it is possible that httpParams will be called by one thread which will set
httpParams, then a second thread may call it and may find httpParams is
non-null. However, under both the old (Java Language Spec chapter 17) and
new Java Memory Models, the second thread won't necessarily see the values
the first thread has set in the referenced HttpParams object.
The easiest way to fix this for all JVMs and memory models is by declaring
getDefaultParams() to be synchronized.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org