Date: 2005-01-16T12:18:49
Editor: RolandWeber
Wiki: Jakarta-HttpClient Wiki
Page: HttpClientApiRedesign
URL: http://wiki.apache.org/jakarta-httpclient/HttpClientApiRedesign
more details in http-async
Change Log:
------------------------------------------------------------------------------
@@ -187,10 +187,11 @@
a. {{{ HttpAsyncLink }}} interface for sending requests asynchronously
a. {{{ HttpAsyncCallback }}} interface
- * default implementation of the asynchronous execution interface.
+ * minimal implementation of the asynchronous execution interface.
- a. {{{ StdAsyncLink }}} class implementing {{{ HttpAsyncLink }}}
- The default implementation expects an {{{ HttpConnection }}} as a constructor
argument. It spawns a new background thread that sends the request over the
connection and waits for a response. The callback interface is invoked by that
thread.
+ a. {{{ SimpleAsyncLink }}} class implementing {{{ HttpAsyncLink }}}
+
+ The minimal implementation spawns a new thread that sends the request over a
connection and waits for a response. The callback interface is invoked by that
thread. The connection is passed to the constructor. The minimal implementation
handles at most one request at a time and therefore does not have to maintain a
request queue. It can be used by applications that want to use a single
connection asynchronously and handle synchronization themselves.
* result lookup interface for HTTP responses.
@@ -201,12 +202,23 @@
a. {{{ StdAsyncCallbackHandler }}} class implementing {{{ HttpAsyncCallback
}}}, {{{ HttpAsyncResult }}}, {{{ HttpAsyncNotify }}}
+ * standard implementation of the asynchronous execution interface.
+
+ a. {{{ StdAsyncLink }}} class implementing {{{ HttpAsyncLink }}}
+ The standard implementation spawns a new thread that alternately sends
requests over a connection and waits for a response. Unlike {{{
SimpleAsyncLink}}}, it maintains a queue of requests to be processed. It can be
used by multiple threads simultaneously. It supports persistent use of a
connection, but not pipelining. The constructor gets either a connection, or a
connection manager.
+
* pipelining implementation of the asynchronous execution interface. See note
on Pipelining below.
a. {{{ PipeliningAsyncLink }}} class implementing {{{ HttpAsyncLink }}}
a. {{{ PipeliningParams }}} class
a. various helper classes to be used by {{{ PipeliningAsyncLink }}}
+ * request queueing, for use by {{{ StdAsyncLink }}} and in particular {{{
PipeliningAsyncLink }}}
+
+ a. {{{ HttpRequestQueue }}} interface
+ a. {{{ StdHttpReqQueue }}} class implementing {{{ HttpRequestQueue }}}
+ In addition to the usual queueing operations, this interface provides methods
for dequeueing bunches of requests targetting the same host. It also includes a
conditional queueing operation that enqueues a request only if it targets the
same host as other requests in the queue. See note on Pipelining below.
+
== http-client ==
possible package name: '''org.apache.http.httpclient'''
@@ -305,7 +317,7 @@
The idea behind the {{{ PipeliningAsyncLink }}} in '''http-async''' is to
start up a pair of background threads for each connection that is used. One
thread sends requests, the other receives the responses on the connection. When
a request is sent over the pipelining link, the class checks whether there is a
connection to that host. If so, it delegates the request to the corresponding
sender thread. Otherwise, it queues the request in a shared queue.
-If there is a request in the sharead queue, a new pair of background threads
can be started with a connection allocated from a connection manager. The
maximum number of connections used for pipelining can be configured lower than
the number of connections in the connection manager. This allows simultaneous
use of the synchronous and asynchronous interfaces for HTTP request processing,
without synchronous requests being delayed forever.
+If there is a request in the shared queue, a new pair of background threads
can be started with a connection allocated from a connection manager. The
maximum number of connections used for pipelining can be configured lower than
the number of connections in the connection manager. This allows simultaneous
use of the synchronous and asynchronous interfaces for HTTP request processing,
without synchronous requests being delayed forever.
Connections are released when a receiving thread detects that there are no
more responses pending on the connection, or when a communication error occurs.
When there are no more requests, connection release can be delayed. In case of
a communication error, requests that are queued on the sending thread are moved
to the shared queue, where they can be picked up again. The error itself is
reported to the callback interfaces for all requests already sent over the
connection for which no response has been received yet.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]