@Contract(threading=IMMUTABLE_CONDITIONAL)
public class HttpAsyncRequester
extends java.lang.Object
HttpAsyncRequester is a utility class that can be used
in conjunction with HttpAsyncRequestExecutor to initiate execution
of asynchronous HTTP requests.HttpAsyncRequestExecutor| Constructor | Description |
|---|---|
HttpAsyncRequester(org.apache.http.protocol.HttpProcessor httpprocessor) |
Creates new instance of HttpAsyncRequester.
|
HttpAsyncRequester(org.apache.http.protocol.HttpProcessor httpprocessor,
org.apache.http.ConnectionReuseStrategy connReuseStrategy) |
Creates new instance of HttpAsyncRequester.
|
HttpAsyncRequester(org.apache.http.protocol.HttpProcessor httpprocessor,
org.apache.http.ConnectionReuseStrategy connReuseStrategy,
org.apache.http.ExceptionLogger exceptionLogger) |
Creates new instance of
HttpAsyncRequester. |
HttpAsyncRequester(org.apache.http.protocol.HttpProcessor httpprocessor,
org.apache.http.ConnectionReuseStrategy reuseStrategy,
org.apache.http.params.HttpParams params) |
Deprecated.
|
| Modifier and Type | Method | Description |
|---|---|---|
<T,E extends org.apache.http.pool.PoolEntry<org.apache.http.HttpHost,NHttpClientConnection>> |
execute(HttpAsyncRequestProducer requestProducer,
HttpAsyncResponseConsumer<T> responseConsumer,
E poolEntry,
org.apache.http.pool.ConnPool<org.apache.http.HttpHost,E> connPool,
org.apache.http.protocol.HttpContext context,
org.apache.http.concurrent.FutureCallback<T> callback) |
Initiates asynchronous HTTP request execution.
|
<T> java.util.concurrent.Future<T> |
execute(HttpAsyncRequestProducer requestProducer,
HttpAsyncResponseConsumer<T> responseConsumer,
NHttpClientConnection conn) |
Initiates asynchronous HTTP request execution.
|
<T> java.util.concurrent.Future<T> |
execute(HttpAsyncRequestProducer requestProducer,
HttpAsyncResponseConsumer<T> responseConsumer,
NHttpClientConnection conn,
org.apache.http.protocol.HttpContext context) |
Initiates asynchronous HTTP request execution.
|
<T> java.util.concurrent.Future<T> |
execute(HttpAsyncRequestProducer requestProducer,
HttpAsyncResponseConsumer<T> responseConsumer,
NHttpClientConnection conn,
org.apache.http.protocol.HttpContext context,
org.apache.http.concurrent.FutureCallback<T> callback) |
Initiates asynchronous HTTP request execution.
|
<T,E extends org.apache.http.pool.PoolEntry<org.apache.http.HttpHost,NHttpClientConnection>> |
execute(HttpAsyncRequestProducer requestProducer,
HttpAsyncResponseConsumer<T> responseConsumer,
org.apache.http.pool.ConnPool<org.apache.http.HttpHost,E> connPool) |
Initiates asynchronous HTTP request execution.
|
<T,E extends org.apache.http.pool.PoolEntry<org.apache.http.HttpHost,NHttpClientConnection>> |
execute(HttpAsyncRequestProducer requestProducer,
HttpAsyncResponseConsumer<T> responseConsumer,
org.apache.http.pool.ConnPool<org.apache.http.HttpHost,E> connPool,
org.apache.http.protocol.HttpContext context) |
Initiates asynchronous HTTP request execution.
|
<T,E extends org.apache.http.pool.PoolEntry<org.apache.http.HttpHost,NHttpClientConnection>> |
execute(HttpAsyncRequestProducer requestProducer,
HttpAsyncResponseConsumer<T> responseConsumer,
org.apache.http.pool.ConnPool<org.apache.http.HttpHost,E> connPool,
org.apache.http.protocol.HttpContext context,
org.apache.http.concurrent.FutureCallback<T> callback) |
Initiates asynchronous HTTP request execution.
|
<T,E extends org.apache.http.pool.PoolEntry<org.apache.http.HttpHost,NHttpClientConnection>> |
executePipelined(java.util.List<HttpAsyncRequestProducer> requestProducers,
java.util.List<HttpAsyncResponseConsumer<T>> responseConsumers,
E poolEntry,
org.apache.http.pool.ConnPool<org.apache.http.HttpHost,E> connPool,
org.apache.http.protocol.HttpContext context,
org.apache.http.concurrent.FutureCallback<java.util.List<T>> callback) |
Initiates asynchronous pipelined HTTP request execution.
|
<T,E extends org.apache.http.pool.PoolEntry<org.apache.http.HttpHost,NHttpClientConnection>> |
executePipelined(org.apache.http.HttpHost target,
java.util.List<? extends HttpAsyncRequestProducer> requestProducers,
java.util.List<? extends HttpAsyncResponseConsumer<T>> responseConsumers,
org.apache.http.pool.ConnPool<org.apache.http.HttpHost,E> connPool,
org.apache.http.protocol.HttpContext context,
org.apache.http.concurrent.FutureCallback<java.util.List<T>> callback) |
Initiates asynchronous pipelined HTTP request execution.
|
protected void |
log(java.lang.Exception ex) |
This method can be used to log I/O exception thrown while closing
Closeable objects (such as
HttpConnection}). |
@Deprecated
public HttpAsyncRequester(org.apache.http.protocol.HttpProcessor httpprocessor,
org.apache.http.ConnectionReuseStrategy reuseStrategy,
org.apache.http.params.HttpParams params)
HttpAsyncRequester(HttpProcessor,
ConnectionReuseStrategy)public HttpAsyncRequester(org.apache.http.protocol.HttpProcessor httpprocessor,
org.apache.http.ConnectionReuseStrategy connReuseStrategy,
org.apache.http.ExceptionLogger exceptionLogger)
HttpAsyncRequester.httpprocessor - HTTP protocol processor.connReuseStrategy - Connection re-use strategy. If null
DefaultConnectionReuseStrategy.INSTANCE will be used.exceptionLogger - Exception logger. If null
ExceptionLogger.NO_OP will be used. Please note that the exception
logger will be only used to log I/O exception thrown while closing
Closeable objects (such as HttpConnection).public HttpAsyncRequester(org.apache.http.protocol.HttpProcessor httpprocessor,
org.apache.http.ConnectionReuseStrategy connReuseStrategy)
public HttpAsyncRequester(org.apache.http.protocol.HttpProcessor httpprocessor)
public <T> java.util.concurrent.Future<T> execute(HttpAsyncRequestProducer requestProducer, HttpAsyncResponseConsumer<T> responseConsumer, NHttpClientConnection conn, org.apache.http.protocol.HttpContext context, org.apache.http.concurrent.FutureCallback<T> callback)
T - the result type of request execution.requestProducer - request producer.responseConsumer - response consumer.conn - underlying HTTP connection.context - HTTP contextcallback - future callback.public <T> java.util.concurrent.Future<T> execute(HttpAsyncRequestProducer requestProducer, HttpAsyncResponseConsumer<T> responseConsumer, NHttpClientConnection conn, org.apache.http.protocol.HttpContext context)
T - the result type of request execution.requestProducer - request producer.responseConsumer - response consumer.conn - underlying HTTP connection.context - HTTP contextpublic <T> java.util.concurrent.Future<T> execute(HttpAsyncRequestProducer requestProducer, HttpAsyncResponseConsumer<T> responseConsumer, NHttpClientConnection conn)
T - the result type of request execution.requestProducer - request producer.responseConsumer - response consumer.conn - underlying HTTP connection.public <T,E extends org.apache.http.pool.PoolEntry<org.apache.http.HttpHost,NHttpClientConnection>> java.util.concurrent.Future<T> execute(HttpAsyncRequestProducer requestProducer, HttpAsyncResponseConsumer<T> responseConsumer, org.apache.http.pool.ConnPool<org.apache.http.HttpHost,E> connPool, org.apache.http.protocol.HttpContext context, org.apache.http.concurrent.FutureCallback<T> callback)
T - the result type of request execution.E - the connection pool entry type.requestProducer - request producer.responseConsumer - response consumer.connPool - pool of persistent reusable connections.context - HTTP contextcallback - future callback.public <T,E extends org.apache.http.pool.PoolEntry<org.apache.http.HttpHost,NHttpClientConnection>> java.util.concurrent.Future<java.util.List<T>> executePipelined(org.apache.http.HttpHost target, java.util.List<? extends HttpAsyncRequestProducer> requestProducers, java.util.List<? extends HttpAsyncResponseConsumer<T>> responseConsumers, org.apache.http.pool.ConnPool<org.apache.http.HttpHost,E> connPool, org.apache.http.protocol.HttpContext context, org.apache.http.concurrent.FutureCallback<java.util.List<T>> callback)
T - the result type of request execution.E - the connection pool entry type.target - target host.requestProducers - list of request producers.responseConsumers - list of response consumers.connPool - pool of persistent reusable connections.context - HTTP contextcallback - future callback.public <T,E extends org.apache.http.pool.PoolEntry<org.apache.http.HttpHost,NHttpClientConnection>> java.util.concurrent.Future<T> execute(HttpAsyncRequestProducer requestProducer, HttpAsyncResponseConsumer<T> responseConsumer, E poolEntry, org.apache.http.pool.ConnPool<org.apache.http.HttpHost,E> connPool, org.apache.http.protocol.HttpContext context, org.apache.http.concurrent.FutureCallback<T> callback)
T - the result type of request execution.E - the connection pool entry type.requestProducer - request producer.responseConsumer - response consumer.poolEntry - leased pool entry. It will be automatically released
back to the pool when execution is completed.connPool - pool of persistent reusable connections.context - HTTP contextcallback - future callback.public <T,E extends org.apache.http.pool.PoolEntry<org.apache.http.HttpHost,NHttpClientConnection>> java.util.concurrent.Future<java.util.List<T>> executePipelined(java.util.List<HttpAsyncRequestProducer> requestProducers, java.util.List<HttpAsyncResponseConsumer<T>> responseConsumers, E poolEntry, org.apache.http.pool.ConnPool<org.apache.http.HttpHost,E> connPool, org.apache.http.protocol.HttpContext context, org.apache.http.concurrent.FutureCallback<java.util.List<T>> callback)
T - the result type of request execution.E - the connection pool entry type.requestProducers - list of request producers.responseConsumers - list of response consumers.poolEntry - leased pool entry. It will be automatically released
back to the pool when execution is completed.connPool - pool of persistent reusable connections.context - HTTP contextcallback - future callback.public <T,E extends org.apache.http.pool.PoolEntry<org.apache.http.HttpHost,NHttpClientConnection>> java.util.concurrent.Future<T> execute(HttpAsyncRequestProducer requestProducer, HttpAsyncResponseConsumer<T> responseConsumer, org.apache.http.pool.ConnPool<org.apache.http.HttpHost,E> connPool, org.apache.http.protocol.HttpContext context)
T - the result type of request execution.E - the connection pool entry type.requestProducer - request producer.responseConsumer - response consumer.connPool - pool of persistent reusable connections.context - HTTP contextpublic <T,E extends org.apache.http.pool.PoolEntry<org.apache.http.HttpHost,NHttpClientConnection>> java.util.concurrent.Future<T> execute(HttpAsyncRequestProducer requestProducer, HttpAsyncResponseConsumer<T> responseConsumer, org.apache.http.pool.ConnPool<org.apache.http.HttpHost,E> connPool)
T - the result type of request execution.E - the connection pool entry type.requestProducer - request producer.responseConsumer - response consumer.connPool - pool of persistent reusable connections.protected void log(java.lang.Exception ex)
Closeable objects (such as
HttpConnection}).ex - I/O exception thrown by Closeable.close()