Class CloseableHttpAsyncClient
- java.lang.Object
-
- org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,HttpAsyncClient
,org.apache.hc.core5.io.ModalCloseable
- Direct Known Subclasses:
AbstractHttpAsyncClientBase
@Contract(threading=STATELESS) public abstract class CloseableHttpAsyncClient extends java.lang.Object implements HttpAsyncClient, org.apache.hc.core5.io.ModalCloseable
Base implementation ofHttpAsyncClient
that also implementsModalCloseable
.- Since:
- 5.0
-
-
Constructor Summary
Constructors Constructor Description CloseableHttpAsyncClient()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
awaitShutdown(org.apache.hc.core5.util.TimeValue waitTime)
protected abstract <T> java.util.concurrent.Future<T>
doExecute(org.apache.hc.core5.http.HttpHost target, org.apache.hc.core5.http.nio.AsyncRequestProducer requestProducer, org.apache.hc.core5.http.nio.AsyncResponseConsumer<T> responseConsumer, org.apache.hc.core5.http.nio.HandlerFactory<org.apache.hc.core5.http.nio.AsyncPushConsumer> pushHandlerFactory, org.apache.hc.core5.http.protocol.HttpContext context, org.apache.hc.core5.concurrent.FutureCallback<T> callback)
java.util.concurrent.Future<SimpleHttpResponse>
execute(SimpleHttpRequest request, org.apache.hc.core5.concurrent.FutureCallback<SimpleHttpResponse> callback)
java.util.concurrent.Future<SimpleHttpResponse>
execute(SimpleHttpRequest request, org.apache.hc.core5.http.protocol.HttpContext context, org.apache.hc.core5.concurrent.FutureCallback<SimpleHttpResponse> callback)
<T> java.util.concurrent.Future<T>
execute(org.apache.hc.core5.http.HttpHost target, org.apache.hc.core5.http.nio.AsyncRequestProducer requestProducer, org.apache.hc.core5.http.nio.AsyncResponseConsumer<T> responseConsumer, org.apache.hc.core5.http.nio.HandlerFactory<org.apache.hc.core5.http.nio.AsyncPushConsumer> pushHandlerFactory, org.apache.hc.core5.http.protocol.HttpContext context, org.apache.hc.core5.concurrent.FutureCallback<T> callback)
<T> java.util.concurrent.Future<T>
execute(org.apache.hc.core5.http.nio.AsyncRequestProducer requestProducer, org.apache.hc.core5.http.nio.AsyncResponseConsumer<T> responseConsumer, org.apache.hc.core5.concurrent.FutureCallback<T> callback)
<T> java.util.concurrent.Future<T>
execute(org.apache.hc.core5.http.nio.AsyncRequestProducer requestProducer, org.apache.hc.core5.http.nio.AsyncResponseConsumer<T> responseConsumer, org.apache.hc.core5.http.nio.HandlerFactory<org.apache.hc.core5.http.nio.AsyncPushConsumer> pushHandlerFactory, org.apache.hc.core5.http.protocol.HttpContext context, org.apache.hc.core5.concurrent.FutureCallback<T> callback)
Initiates asynchronous HTTP request execution using the given context.<T> java.util.concurrent.Future<T>
execute(org.apache.hc.core5.http.nio.AsyncRequestProducer requestProducer, org.apache.hc.core5.http.nio.AsyncResponseConsumer<T> responseConsumer, org.apache.hc.core5.http.protocol.HttpContext context, org.apache.hc.core5.concurrent.FutureCallback<T> callback)
abstract org.apache.hc.core5.reactor.IOReactorStatus
getStatus()
abstract void
initiateShutdown()
abstract void
register(java.lang.String hostname, java.lang.String uriPattern, org.apache.hc.core5.function.Supplier<org.apache.hc.core5.http.nio.AsyncPushConsumer> supplier)
void
register(java.lang.String uriPattern, org.apache.hc.core5.function.Supplier<org.apache.hc.core5.http.nio.AsyncPushConsumer> supplier)
abstract void
start()
-
-
-
Method Detail
-
start
public abstract void start()
-
getStatus
public abstract org.apache.hc.core5.reactor.IOReactorStatus getStatus()
-
awaitShutdown
public abstract void awaitShutdown(org.apache.hc.core5.util.TimeValue waitTime) throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
initiateShutdown
public abstract void initiateShutdown()
-
doExecute
protected abstract <T> java.util.concurrent.Future<T> doExecute(org.apache.hc.core5.http.HttpHost target, org.apache.hc.core5.http.nio.AsyncRequestProducer requestProducer, org.apache.hc.core5.http.nio.AsyncResponseConsumer<T> responseConsumer, org.apache.hc.core5.http.nio.HandlerFactory<org.apache.hc.core5.http.nio.AsyncPushConsumer> pushHandlerFactory, org.apache.hc.core5.http.protocol.HttpContext context, org.apache.hc.core5.concurrent.FutureCallback<T> callback)
-
execute
public final <T> java.util.concurrent.Future<T> execute(org.apache.hc.core5.http.HttpHost target, org.apache.hc.core5.http.nio.AsyncRequestProducer requestProducer, org.apache.hc.core5.http.nio.AsyncResponseConsumer<T> responseConsumer, org.apache.hc.core5.http.nio.HandlerFactory<org.apache.hc.core5.http.nio.AsyncPushConsumer> pushHandlerFactory, org.apache.hc.core5.http.protocol.HttpContext context, org.apache.hc.core5.concurrent.FutureCallback<T> callback)
-
execute
public final <T> java.util.concurrent.Future<T> execute(org.apache.hc.core5.http.nio.AsyncRequestProducer requestProducer, org.apache.hc.core5.http.nio.AsyncResponseConsumer<T> responseConsumer, org.apache.hc.core5.http.nio.HandlerFactory<org.apache.hc.core5.http.nio.AsyncPushConsumer> pushHandlerFactory, org.apache.hc.core5.http.protocol.HttpContext context, org.apache.hc.core5.concurrent.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 interfaceHttpAsyncClient
- 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 benull
.context
- HTTP context. Optional and may benull
.callback
- future callback. Optional and may benull
.- Returns:
- future representing pending completion of the operation.
-
execute
public final <T> java.util.concurrent.Future<T> execute(org.apache.hc.core5.http.nio.AsyncRequestProducer requestProducer, org.apache.hc.core5.http.nio.AsyncResponseConsumer<T> responseConsumer, org.apache.hc.core5.http.protocol.HttpContext context, org.apache.hc.core5.concurrent.FutureCallback<T> callback)
-
execute
public final <T> java.util.concurrent.Future<T> execute(org.apache.hc.core5.http.nio.AsyncRequestProducer requestProducer, org.apache.hc.core5.http.nio.AsyncResponseConsumer<T> responseConsumer, org.apache.hc.core5.concurrent.FutureCallback<T> callback)
-
execute
public final java.util.concurrent.Future<SimpleHttpResponse> execute(SimpleHttpRequest request, org.apache.hc.core5.http.protocol.HttpContext context, org.apache.hc.core5.concurrent.FutureCallback<SimpleHttpResponse> callback)
-
execute
public final java.util.concurrent.Future<SimpleHttpResponse> execute(SimpleHttpRequest request, org.apache.hc.core5.concurrent.FutureCallback<SimpleHttpResponse> callback)
-
register
public abstract void register(java.lang.String hostname, java.lang.String uriPattern, org.apache.hc.core5.function.Supplier<org.apache.hc.core5.http.nio.AsyncPushConsumer> supplier)
-
register
public final void register(java.lang.String uriPattern, org.apache.hc.core5.function.Supplier<org.apache.hc.core5.http.nio.AsyncPushConsumer> supplier)
-
-