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/09/26 10:12:41 UTC

svn commit: r1390314 - in /httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent: Executor.java Response.java

Author: olegk
Date: Wed Sep 26 08:12:40 2012
New Revision: 1390314

URL: http://svn.apache.org/viewvc?rev=1390314&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/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java
    httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Response.java

Modified: httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java?rev=1390314&r1=1390313&r2=1390314&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java (original)
+++ httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java Wed Sep 26 08:12:40 2012
@@ -58,6 +58,12 @@ import org.apache.http.impl.client.HttpC
 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/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Response.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Response.java?rev=1390314&r1=1390313&r2=1390314&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Response.java (original)
+++ httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Response.java Wed Sep 26 08:12:40 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();