org.apache.hc.client5.http.impl.async

## Class CloseableHttpAsyncClient

- java.lang.Object
- - org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient

All Implemented Interfaces:
  Closeable, AutoCloseable, HttpAsyncClient, ModalCloseable

Direct Known Subclasses:
  InternalH2AsyncClient, InternalHttpAsyncClient, MinimalH2AsyncClient, MinimalHttpAsyncClient

    @Contract(threading=STATELESS)
    public abstract class CloseableHttpAsyncClient
    extends Object
    implements HttpAsyncClient, ModalCloseable

Base implementation of `HttpAsyncClient` that also implements `ModalCloseable`.

Since:
  5.0

### Constructor Summary

Constructors
Constructor and Description
`CloseableHttpAsyncClient()`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`abstract void` `awaitShutdown(TimeValue waitTime)`
`protected abstract <T> Future<T>` `doExecute(HttpHost target, AsyncRequestProducer requestProducer, AsyncResponseConsumer<T> responseConsumer, HandlerFactory<AsyncPushConsumer> pushHandlerFactory, HttpContext context, FutureCallback<T> callback)`
`<T> Future<T>` `execute(AsyncRequestProducer requestProducer, AsyncResponseConsumer<T> responseConsumer, FutureCallback<T> callback)`
`<T> Future<T>` `execute(AsyncRequestProducer requestProducer, AsyncResponseConsumer<T> responseConsumer, HandlerFactory<AsyncPushConsumer> pushHandlerFactory, HttpContext context, FutureCallback<T> callback)` Initiates asynchronous HTTP request execution using the given context.
`<T> Future<T>` `execute(AsyncRequestProducer requestProducer, AsyncResponseConsumer<T> responseConsumer, HttpContext context, FutureCallback<T> callback)`
`<T> Future<T>` `execute(HttpHost target, AsyncRequestProducer requestProducer, AsyncResponseConsumer<T> responseConsumer, HandlerFactory<AsyncPushConsumer> pushHandlerFactory, HttpContext context, FutureCallback<T> callback)`
`Future<SimpleHttpResponse>` `execute(SimpleHttpRequest request, FutureCallback<SimpleHttpResponse> callback)`
`Future<SimpleHttpResponse>` `execute(SimpleHttpRequest request, HttpContext context, FutureCallback<SimpleHttpResponse> callback)`
`abstract IOReactorStatus` `getStatus()`
`abstract void` `initiateShutdown()`
`abstract void` `register(String hostname, String uriPattern, Supplier<AsyncPushConsumer> supplier)`
`void` `register(String uriPattern, Supplier<AsyncPushConsumer> supplier)`
`abstract void` `start()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.apache.hc.core5.io.ModalCloseable

`close`

### Methods inherited from interface java.io.Closeable

`close`

### Constructor Detail

#### CloseableHttpAsyncClient

    public CloseableHttpAsyncClient()

### Method Detail

#### start

    public abstract void start()

#### getStatus

    public abstract IOReactorStatus getStatus()

#### awaitShutdown

    public abstract void awaitShutdown(TimeValue waitTime)
                                throws InterruptedException

Throws:
  `InterruptedException`

#### initiateShutdown

    public abstract void initiateShutdown()

#### doExecute

    protected abstract <T> Future<T> doExecute(HttpHost target,
                                               AsyncRequestProducer requestProducer,
                                               AsyncResponseConsumer<T> responseConsumer,
                                               HandlerFactory<AsyncPushConsumer> pushHandlerFactory,
                                               HttpContext context,
                                               FutureCallback<T> callback)

#### execute

    public final <T> Future<T> execute(HttpHost target,
                                       AsyncRequestProducer requestProducer,
                                       AsyncResponseConsumer<T> responseConsumer,
                                       HandlerFactory<AsyncPushConsumer> pushHandlerFactory,
                                       HttpContext context,
                                       FutureCallback<T> callback)

#### execute

    public final <T> Future<T> execute(AsyncRequestProducer requestProducer,
                                       AsyncResponseConsumer<T> responseConsumer,
                                       HandlerFactory<AsyncPushConsumer> pushHandlerFactory,
                                       HttpContext context,
                                       FutureCallback<T> callback)

Description copied from interface: `HttpAsyncClient`
Initiates asynchronous HTTP request execution using the given context.

The request producer passed to this method will be used to generate a request message and stream out its content without buffering it in memory. The response consumer passed to this method will be used to process a response message without buffering its content in memory.

Please note it may be unsafe to interact with the context instance while the request is still being executed.

Specified by:
  `execute` in interface `HttpAsyncClient`
Type Parameters:
  `T` - the result type of request execution.
Parameters:
  `requestProducer` - request producer callback.
  `responseConsumer` - response consumer callback.
  `pushHandlerFactory` - the push handler factory. Optional and may be `null`.
  `context` - HTTP context. Optional and may be `null`.
  `callback` - future callback. Optional and may be `null`.
Returns:
  future representing pending completion of the operation.

#### execute

    public final <T> Future<T> execute(AsyncRequestProducer requestProducer,
                                       AsyncResponseConsumer<T> responseConsumer,
                                       HttpContext context,
                                       FutureCallback<T> callback)

#### execute

    public final <T> Future<T> execute(AsyncRequestProducer requestProducer,
                                       AsyncResponseConsumer<T> responseConsumer,
                                       FutureCallback<T> callback)

#### execute

    public final Future<SimpleHttpResponse> execute(SimpleHttpRequest request,
                                                    HttpContext context,
                                                    FutureCallback<SimpleHttpResponse> callback)

#### execute

    public final Future<SimpleHttpResponse> execute(SimpleHttpRequest request,
                                                    FutureCallback<SimpleHttpResponse> callback)

#### register

    public abstract void register(String hostname,
                                  String uriPattern,
                                  Supplier<AsyncPushConsumer> supplier)

#### register

    public final void register(String uriPattern,
                               Supplier<AsyncPushConsumer> supplier)