hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r720832 - in /httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol: BufferingHttpClientHandler.java BufferingHttpServiceHandler.java ThrottlingHttpClientHandler.java ThrottlingHttpServiceHandler.java
Date Wed, 26 Nov 2008 12:34:10 GMT
Author: olegk
Date: Wed Nov 26 04:34:09 2008
New Revision: 720832

URL: http://svn.apache.org/viewvc?rev=720832&view=rev
Log:
Javadoc updates

Modified:
    httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpClientHandler.java
    httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpServiceHandler.java
    httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpClientHandler.java
    httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java

Modified: httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpClientHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpClientHandler.java?rev=720832&r1=720831&r2=720832&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpClientHandler.java
(original)
+++ httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpClientHandler.java
Wed Nov 26 04:34:09 2008
@@ -32,8 +32,11 @@
 package org.apache.http.nio.protocol;
 
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 
 import org.apache.http.ConnectionReuseStrategy;
+import org.apache.http.HttpEntity;
 import org.apache.http.HttpException;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
@@ -50,11 +53,20 @@
 import org.apache.http.protocol.HttpProcessor;
 
 /**
- * HTTP client handler implementation that buffers the content of HTTP messages 
- * entirely in memory and executes HTTP requests on the main I/O thread.
- * 
- * <p>This service handler should be used only when dealing with HTTP messages 
- * that are known to be limited in length</p>
+ * Client protocol handler implementation that provides compatibility with the 
+ * blocking I/O by storing the full content of HTTP messages in memory. 
+ * The {@link HttpRequestExecutionHandler#handleResponse(HttpResponse, HttpContext)}
+ * method will fire only when the entire message content has been read into a 
+ * in-memory buffer. Please note that request execution / reponse processing 
+ * take place the main I/O thread and therefore {@link HttpRequestExecutionHandler}
+ * methods should not block indefinitely.
+ * <p/>
+ * When using this protocol handelr {@link HttpEntity}'s content can be 
+ * generated / consumed using standard {@link InputStream} / {@link OutputStream} 
+ * classes.
+ * <p/>
+ * IMPORTANT: This protocol handler should be used only when dealing with HTTP 
+ * messages that are known to be limited in length.
  * 
  * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
  *

Modified: httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpServiceHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpServiceHandler.java?rev=720832&r1=720831&r2=720832&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpServiceHandler.java
(original)
+++ httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpServiceHandler.java
Wed Nov 26 04:34:09 2008
@@ -32,8 +32,11 @@
 package org.apache.http.nio.protocol;
 
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 
 import org.apache.http.ConnectionReuseStrategy;
+import org.apache.http.HttpEntity;
 import org.apache.http.HttpEntityEnclosingRequest;
 import org.apache.http.HttpException;
 import org.apache.http.HttpRequest;
@@ -55,11 +58,20 @@
 import org.apache.http.protocol.HttpRequestHandlerResolver;
 
 /**
- * HTTP service handler implementation that buffers the content of HTTP messages
- * entirely in memory and processes HTTP requests on the main I/O thread.
- *
- * <p>This service handler should be used only when dealing with HTTP messages
- * that are known to be limited in length</p>
+ * Service protocol handler implementations that provide compatibility with 
+ * the blocking I/O by storing the full content of HTTP messages in memory. 
+ * The {@link HttpRequestHandler#handle(HttpRequest, HttpResponse, HttpContext)}
+ * method will fire only when the entire message content has been read into 
+ * an in-memory buffer. Please note that request processing take place the 
+ * main I/O thread and therefore individual HTTP request handlers should not 
+ * block indefinitely. 
+ * <p/>
+ * When using this protocol handelr {@link HttpEntity}'s content can be 
+ * generated / consumed using standard {@link InputStream} / {@link OutputStream} 
+ * classes.
+ * <p/>
+ * IMPORTANT: This protocol handler should be used only when dealing with HTTP 
+ * messages that are known to be limited in length.
  *
  * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
  *

Modified: httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpClientHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpClientHandler.java?rev=720832&r1=720831&r2=720832&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpClientHandler.java
(original)
+++ httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpClientHandler.java
Wed Nov 26 04:34:09 2008
@@ -65,16 +65,28 @@
 import org.apache.http.protocol.HttpProcessor;
 
 /**
- * HTTP client handler implementation that allocates content buffers of limited 
- * size upon initialization and is capable of controlling the frequency of I/O 
- * events in order to guarantee those content buffers do not ever get overflown. 
- * This helps ensure near constant memory footprint of HTTP connections and to 
- * avoid the 'out of memory' condition while streaming out response content.
- * 
- * <p>The client handler will delegate the tasks of sending entity enclosing 
- * HTTP requests and processing of HTTP responses to an {@link Executor}, 
- * which is expected to perform those tasks using dedicated worker threads in 
- * order to avoid blocking the I/O thread.</p>
+ * Client protocol handler implementation that provide compatibility with 
+ * the blocking I/O by utilizing shared content buffers and a fairly small pool 
+ * of worker threads. The throttling protocol handler allocates input / output 
+ * buffers of a constant length upon initialization and controls the rate of 
+ * I/O events in order to ensure those content buffers do not ever get 
+ * overflown. This helps ensure nearly constant memory footprint for HTTP 
+ * connections and avoid the out of memory condition while streaming content 
+ * in and out. The {@link HttpRequestExecutionHandler#handleResponse(HttpResponse, HttpContext)}
+ * method will fire immediately when a message is received. The protocol handler 
+ * delegate the task of processing requests and generating response content to 
+ * an {@link Executor}, which is expected to perform those tasks using 
+ * dedicated worker threads in order to avoid blocking the I/O thread.  
+ * <p/>
+ * Usually throttling protocol handlers need only a modest number of worker 
+ * threads, much fewer than the number of concurrent connections. If the length 
+ * of the message is smaller or about the size of the shared content buffer 
+ * worker thread will just store content in the buffer and terminate almost 
+ * immediately without blocking. The I/O dispatch thread in its turn will take 
+ * care of sending out the buffered content asynchronously. The worker thread 
+ * will have to block only when processing large messages and the shared buffer 
+ * fills up. It is generally advisable to allocate shared buffers of a size of 
+ * an average content body for optimal performance.
  * 
  * @see NIOReactorPNames#CONTENT_BUFFER_SIZE
  * 

Modified: httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java?rev=720832&r1=720831&r2=720832&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java
(original)
+++ httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java
Wed Nov 26 04:34:09 2008
@@ -75,16 +75,28 @@
 import org.apache.http.util.EncodingUtils;
 
 /**
- * HTTP service handler implementation that allocates content buffers of limited 
- * size upon initialization and is capable of controlling the frequency of I/O 
- * events in order to guarantee those content buffers do not ever get overflown. 
- * This helps ensure near constant memory footprint of HTTP connections and to 
- * avoid the 'out of memory' condition while streaming out response content.
- * 
- * <p>The service handler will delegate the task of processing requests and 
- * generating response content to an {@link Executor}, which is expected to
- * perform those tasks using dedicated worker threads in order to avoid 
- * blocking the I/O thread.</p>
+ * Service protocol handler implementation that provide compatibility with 
+ * the blocking I/O by utilizing shared content buffers and a fairly small pool 
+ * of worker threads. The throttling protocol handler allocates input / output 
+ * buffers of a constant length upon initialization and controls the rate of 
+ * I/O events in order to ensure those content buffers do not ever get 
+ * overflown. This helps ensure nearly constant memory footprint for HTTP 
+ * connections and avoid the out of memory condition while streaming content 
+ * in and out. The {@link HttpRequestHandler#handle(HttpRequest, HttpResponse, HttpContext)}
+ * method will fire immediately when a message is received. The protocol handler 
+ * delegate the task of processing requests and generating response content to 
+ * an {@link Executor}, which is expected to perform those tasks using 
+ * dedicated worker threads in order to avoid blocking the I/O thread.  
+ * <p/>
+ * Usually throttling protocol handlers need only a modest number of worker 
+ * threads, much fewer than the number of concurrent connections. If the length 
+ * of the message is smaller or about the size of the shared content buffer 
+ * worker thread will just store content in the buffer and terminate almost 
+ * immediately without blocking. The I/O dispatch thread in its turn will take 
+ * care of sending out the buffered content asynchronously. The worker thread 
+ * will have to block only when processing large messages and the shared buffer 
+ * fills up. It is generally advisable to allocate shared buffers of a size of 
+ * an average content body for optimal performance.
  * 
  * @see NIOReactorPNames#CONTENT_BUFFER_SIZE
  * 



Mime
View raw message