You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2012/03/03 14:32:12 UTC
svn commit: r1296623 - in /httpcomponents/httpclient/trunk/src/docbkx:
connmgmt.xml fundamentals.xml
Author: olegk
Date: Sat Mar 3 13:32:12 2012
New Revision: 1296623
URL: http://svn.apache.org/viewvc?rev=1296623&view=rev
Log:
HTTPCLIENT-1168: updated tutorial to describe recommended application of HttpContext in multi-threaded execution
Modified:
httpcomponents/httpclient/trunk/src/docbkx/connmgmt.xml
httpcomponents/httpclient/trunk/src/docbkx/fundamentals.xml
Modified: httpcomponents/httpclient/trunk/src/docbkx/connmgmt.xml
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/src/docbkx/connmgmt.xml?rev=1296623&r1=1296622&r2=1296623&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/src/docbkx/connmgmt.xml (original)
+++ httpcomponents/httpclient/trunk/src/docbkx/connmgmt.xml Sat Mar 3 13:32:12 2012
@@ -626,6 +626,10 @@ for (int j = 0; j < threads.length; j++)
}
]]></programlisting>
+ <para>While <interfacename>HttpClient</interfacename> instances are thread safe and can be
+ shared between multiple threads of execution, it is highly recommended that each
+ thread maintains its own dedicated instance of <interfacename>HttpContext
+ </interfacename>.</para>
<programlisting><![CDATA[
static class GetThread extends Thread {
Modified: httpcomponents/httpclient/trunk/src/docbkx/fundamentals.xml
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/src/docbkx/fundamentals.xml?rev=1296623&r1=1296622&r2=1296623&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/src/docbkx/fundamentals.xml (original)
+++ httpcomponents/httpclient/trunk/src/docbkx/fundamentals.xml Sat Mar 3 13:32:12 2012
@@ -473,6 +473,9 @@ byte[] response = httpclient.execute(htt
simply a collection of arbitrary named values. An application can populate context
attributes prior to request execution or examine the context after the execution has
been completed.</para>
+ <para><interfacename>HttpContext</interfacename> can contain arbitrary objects and
+ therefore may be unsafe to share between multiple threads. It is recommended that
+ each thread of execution maintains its own context.</para>
<para>In the course of HTTP request execution HttpClient adds the following attributes to
the execution context:</para>
<itemizedlist>