|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.http.impl.client.FutureRequestExecutionService
@Contract(threading=SAFE) public class FutureRequestExecutionService
HttpAsyncClientWithFuture wraps calls to execute with a HttpRequestFutureTask
and schedules them using the provided executor service. Scheduled calls may be cancelled.
Constructor Summary | |
---|---|
FutureRequestExecutionService(HttpClient httpclient,
ExecutorService executorService)
Create a new FutureRequestExecutionService. |
Method Summary | ||
---|---|---|
void |
close()
|
|
|
execute(HttpUriRequest request,
org.apache.http.protocol.HttpContext context,
ResponseHandler<T> responseHandler)
Schedule a request for execution. |
|
|
execute(HttpUriRequest request,
org.apache.http.protocol.HttpContext context,
ResponseHandler<T> responseHandler,
org.apache.http.concurrent.FutureCallback<T> callback)
Schedule a request for execution. |
|
FutureRequestExecutionMetrics |
metrics()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FutureRequestExecutionService(HttpClient httpclient, ExecutorService executorService)
httpclient
- you should tune your httpclient instance to match your needs. You should
align the max number of connections in the pool and the number of threads
in the executor; it doesn't make sense to have more threads than connections
and if you have less connections than threads, the threads will just end up
blocking on getting a connection from the pool.executorService
- any executorService will do here. E.g.
Executors.newFixedThreadPool(int)
Method Detail |
---|
public <T> HttpRequestFutureTask<T> execute(HttpUriRequest request, org.apache.http.protocol.HttpContext context, ResponseHandler<T> responseHandler)
T
- request
- request to executeresponseHandler
- handler that will process the response.
public <T> HttpRequestFutureTask<T> execute(HttpUriRequest request, org.apache.http.protocol.HttpContext context, ResponseHandler<T> responseHandler, org.apache.http.concurrent.FutureCallback<T> callback)
T
- request
- request to executecontext
- optional context; use null if not needed.responseHandler
- handler that will process the response.callback
- callback handler that will be called when the request is scheduled,
started, completed, failed, or cancelled.
public FutureRequestExecutionMetrics metrics()
FutureRequestExecutionMetrics
public void close() throws IOException
close
in interface Closeable
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |