hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1390318 - in /httpcomponents/httpclient/branches/4.2.x/fluent-hc/src/main/java/org/apache/http/client/fluent: Executor.java Response.java
Date Wed, 26 Sep 2012 08:15:57 GMT
Author: olegk
Date: Wed Sep 26 08:15:56 2012
New Revision: 1390318

URL: http://svn.apache.org/viewvc?rev=1390318&view=rev
Log:
HTTPCLIENT-1235: Add javadoc to Executor to explain that response must be handled to avoid
connection leakage
Contributed by Alf H√łgemark <alf at i100.no>

Modified:
    httpcomponents/httpclient/branches/4.2.x/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java
    httpcomponents/httpclient/branches/4.2.x/fluent-hc/src/main/java/org/apache/http/client/fluent/Response.java

Modified: httpcomponents/httpclient/branches/4.2.x/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.2.x/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java?rev=1390318&r1=1390317&r2=1390318&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.2.x/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java
(original)
+++ httpcomponents/httpclient/branches/4.2.x/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java
Wed Sep 26 08:15:56 2012
@@ -58,6 +58,12 @@ import org.apache.http.impl.client.Defau
 import org.apache.http.impl.conn.PoolingClientConnectionManager;
 import org.apache.http.protocol.BasicHttpContext;
 
+/**
+ * An Executor for fluent requests
+ * <p/>
+ * A {@link PoolingClientConnectionManager} with maximum 100 connections per route and
+ * a total maximum of 200 connections is used internally.
+ */
 public class Executor {
 
     final static PoolingClientConnectionManager CONNMGR;
@@ -178,6 +184,14 @@ public class Executor {
         return this;
     }
 
+    /**
+     * Executes the request. Please Note that response content must be processed 
+     * or discarded using {@link Response#discardContent()}, otherwise the
+     * connection used for the request might not be released to the pool.
+     * 
+     * @see Response#handleResponse(org.apache.http.client.ResponseHandler)
+     * @see Response#discardContent()
+     */
     public Response execute(
             final Request request) throws ClientProtocolException, IOException {
         this.localContext.setAttribute(ClientContext.CREDS_PROVIDER, this.credentialsProvider);

Modified: httpcomponents/httpclient/branches/4.2.x/fluent-hc/src/main/java/org/apache/http/client/fluent/Response.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.2.x/fluent-hc/src/main/java/org/apache/http/client/fluent/Response.java?rev=1390318&r1=1390317&r2=1390318&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.2.x/fluent-hc/src/main/java/org/apache/http/client/fluent/Response.java
(original)
+++ httpcomponents/httpclient/branches/4.2.x/fluent-hc/src/main/java/org/apache/http/client/fluent/Response.java
Wed Sep 26 08:15:56 2012
@@ -68,10 +68,16 @@ public class Response {
         }
     }
 
+    /**
+     * Discards response content and deallocates all resources associated with it.
+     */
     public void discardContent() {
         dispose();
     }
 
+    /**
+     * Handles the response using the specified {@link ResponseHandler}
+     */
     public <T> T handleResponse(
             final ResponseHandler<T> handler) throws ClientProtocolException, IOException
{
         assertNotConsumed();



Mime
View raw message