FutureTasks with the provided ExecutorService.
| Modifier and Type | Field and Description |
|---|---|
| private final AtomicBoolean | |
| private final ExecutorService | |
| private final HttpClient | |
| private final FutureRequestExecutionMetrics |
| Access | Constructor and Description |
|---|---|
| public | FutureRequestExecutionService(final 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. httpclient, final ExecutorService any executorService will do here. E.g.
executorService)java.Create a new FutureRequestExecutionService. |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Implements java. |
| public <T> FutureTask | Returns: HttpAsyncClientFutureTask for the scheduled request.request to execute request, final HttpContext context, final HttpClientResponseHandler<T> handler that will process the response. HttpClientResponseHandler)Schedule a request for execution. |
| public <T> FutureTask | Returns: HttpAsyncClientFutureTask for the scheduled request.request to execute request, final HttpContext optional context; use null if not needed. context, final HttpClientResponseHandler<T> handler that will process the response. HttpClientResponseHandler, final FutureCallback<T> callback handler that will be called when the request is scheduled,
started, completed, failed, or cancelled. callback)Schedule a request for execution. |
| public FutureRequestExecutionMetrics |
| closed | back to summary |
|---|---|
| private final AtomicBoolean closed | |
| executorService | back to summary |
|---|---|
| private final ExecutorService executorService | |
| httpclient | back to summary |
|---|---|
| private final HttpClient httpclient | |
| metrics | back to summary |
|---|---|
| private final FutureRequestExecutionMetrics metrics | |
| FutureRequestExecutionService | back to summary |
|---|---|
| public FutureRequestExecutionService(final HttpClient httpclient, final ExecutorService executorService) Create a new FutureRequestExecutionService.
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Implements java. Doc from java. Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect. As noted in
| |
| execute | back to summary |
|---|---|
| public <T> FutureTask Schedule a request for execution.
| |
| execute | back to summary |
|---|---|
| public <T> FutureTask Schedule a request for execution.
| |
| metrics | back to summary |
|---|---|
public FutureRequestExecutionMetrics metrics()
| |