hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r820971 [2/2] - in /httpcomponents/httpclient/trunk: ./ httpclient/src/examples/org/apache/http/examples/client/ httpclient/src/examples/org/apache/http/examples/conn/ httpclient/src/main/java/org/apache/http/conn/params/ httpclient/src/mai...
Date Fri, 02 Oct 2009 11:33:01 GMT
Modified: httpcomponents/httpclient/trunk/src/docbkx/connmgmt.xml
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/src/docbkx/connmgmt.xml?rev=820971&r1=820970&r2=820971&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/src/docbkx/connmgmt.xml (original)
+++ httpcomponents/httpclient/trunk/src/docbkx/connmgmt.xml Fri Oct  2 11:33:00 2009
@@ -459,12 +459,10 @@
                 unintentionally.</para>
             <para>This is an example of acquiring a connection from a connection manager:</para>
             <programlisting><![CDATA[
-HttpParams params = new BasicHttpParams();
 Scheme http = new Scheme("http", PlainSocketFactory.getSocketFactory(), 80);
 SchemeRegistry sr = new SchemeRegistry();
 sr.register(http);
-
-ClientConnectionManager connMrg = new SingleClientConnManager(params, sr);
+ClientConnectionManager connMrg = new SingleClientConnManager(sr);
 
 // Request new connection. This can be a long process
 ClientConnectionRequest connRequest = connMrg.requestConnection(
@@ -546,24 +544,22 @@
                 services. Connection limits, however, can be adjusted using HTTP parameters.</para>
             <para>This example shows how the connection pool parameters can be adjusted:</para>
             <programlisting><![CDATA[
-HttpParams params = new BasicHttpParams();
-// Increase max total connection to 200
-ConnManagerParams.setMaxTotalConnections(params, 200);
-// Increase default max connection per route to 20
-ConnPerRouteBean connPerRoute = new ConnPerRouteBean(20);
-// Increase max connections for localhost:80 to 50
-HttpHost localhost = new HttpHost("locahost", 80);
-connPerRoute.setMaxForRoute(new HttpRoute(localhost), 50);
-ConnManagerParams.setMaxConnectionsPerRoute(params, connPerRoute);
-
 SchemeRegistry schemeRegistry = new SchemeRegistry();
 schemeRegistry.register(
-        new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
+         new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
 schemeRegistry.register(
-        new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
+         new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
 
-ClientConnectionManager cm = new ThreadSafeClientConnManager(params, schemeRegistry);
-HttpClient httpClient = new DefaultHttpClient(cm, params);
+ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager(schemeRegistry);
+// Increase max total connection to 200
+cm.setMaxTotalConnections(200);
+// Increase default max connection per route to 20
+cm.setDefaultMaxPerRoute(20);
+// Increase max connections for localhost:80 to 50
+HttpHost localhost = new HttpHost("locahost", 80);
+cm.setMaxForRoute(new HttpRoute(localhost), 50);
+ 
+HttpClient httpClient = new DefaultHttpClient(cm);
 ]]></programlisting>
         </section>
         <section>
@@ -601,24 +597,6 @@
                         timeout).</para>
                 </formalpara>
             </listitem>
-            <listitem>
-                <formalpara>
-                    <title>'http.conn-manager.max-per-route':</title>
-                    <para>defines the maximum number of connections per route. This
limit is
-                        interpreted by client connection managers and applies to individual
manager
-                        instances. This parameter expects a value of type
-                            <interfacename>ConnPerRoute</interfacename>.</para>
-                </formalpara>
-            </listitem>
-            <listitem>
-                <formalpara>
-                    <title>'http.conn-manager.max-total':</title>
-                    <para>defines the maximum number of connections in total. This
limit is
-                        interpreted by client connection managers and applies to individual
manager
-                        instances. This parameter expects a value of type
-                            <classname>java.lang.Integer</classname>.</para>
-                </formalpara>
-            </listitem>
         </itemizedlist>
     </section>
     <section>
@@ -634,13 +612,12 @@
             If the connection request cannot be serviced within the given time period
                 <exceptionname>ConnectionPoolTimeoutException</exceptionname>
will be thrown.</para>
         <programlisting><![CDATA[
-HttpParams params = new BasicHttpParams();
 SchemeRegistry schemeRegistry = new SchemeRegistry();
 schemeRegistry.register(
         new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
 
-ClientConnectionManager cm = new ThreadSafeClientConnManager(params, schemeRegistry);
-HttpClient httpClient = new DefaultHttpClient(cm, params);
+ClientConnectionManager cm = new ThreadSafeClientConnManager(schemeRegistry);
+HttpClient httpClient = new DefaultHttpClient(cm);
 
 // URIs to perform GETs on
 String[] urisToGet = {



Mime
View raw message