Class AsyncConnectionEndpoint
java.lang.Object
org.apache.hc.client5.http.nio.AsyncConnectionEndpoint
- All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.hc.core5.io.ModalCloseable
- Direct Known Subclasses:
PoolingAsyncClientConnectionManager.InternalConnectionEndpoint
@Contract(threading=SAFE)
public abstract class AsyncConnectionEndpoint
extends Object
implements org.apache.hc.core5.io.ModalCloseable
Client connection endpoint that can be used to execute message exchanges.
- Since:
- 5.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidclose()abstract voidexecute(String id, org.apache.hc.core5.http.nio.AsyncClientExchangeHandler exchangeHandler, org.apache.hc.core5.http.nio.HandlerFactory<org.apache.hc.core5.http.nio.AsyncPushConsumer> pushHandlerFactory, org.apache.hc.core5.http.protocol.HttpContext context) Initiates a message exchange using the given handler.voidexecute(String id, org.apache.hc.core5.http.nio.AsyncClientExchangeHandler exchangeHandler, org.apache.hc.core5.http.protocol.HttpContext context) Initiates a message exchange using the given handler.final <T> Future<T> execute(String id, 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) Initiates message exchange using the given request producer and response consumer.final <T> Future<T> execute(String id, 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.concurrent.FutureCallback<T> callback) Initiates message exchange using the given request producer and response consumer.final <T> Future<T> execute(String id, 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 message exchange using the given request producer and response consumer.final <T> Future<T> execute(String id, 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) Initiates message exchange using the given request producer and response consumer.getInfo()Returns information about the endpoint ornullwhen not connected.abstract booleanDetermines if the connection to the remote endpoint is still open and valid.abstract voidsetSocketTimeout(org.apache.hc.core5.util.Timeout timeout) Sets socket timeout.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hc.core5.io.ModalCloseable
close
-
Constructor Details
-
AsyncConnectionEndpoint
public AsyncConnectionEndpoint()
-
-
Method Details
-
execute
public abstract void execute(String id, org.apache.hc.core5.http.nio.AsyncClientExchangeHandler exchangeHandler, org.apache.hc.core5.http.nio.HandlerFactory<org.apache.hc.core5.http.nio.AsyncPushConsumer> pushHandlerFactory, org.apache.hc.core5.http.protocol.HttpContext context) Initiates a message exchange using the given handler.- Parameters:
id- unique operation ID ornull.exchangeHandler- the message exchange handler.pushHandlerFactory- the push handler factory.context- the execution context.
-
isConnected
public abstract boolean isConnected()Determines if the connection to the remote endpoint is still open and valid. -
setSocketTimeout
public abstract void setSocketTimeout(org.apache.hc.core5.util.Timeout timeout) Sets socket timeout.- Parameters:
timeout- the socket timeout.
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
execute
public void execute(String id, org.apache.hc.core5.http.nio.AsyncClientExchangeHandler exchangeHandler, org.apache.hc.core5.http.protocol.HttpContext context) Initiates a message exchange using the given handler.- Parameters:
id- unique operation ID ornull.exchangeHandler- the message exchange handler.context- the execution context.
-
execute
public final <T> Future<T> execute(String id, 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 message exchange using the given request producer and response consumer.- Type Parameters:
T- the result representation.- Parameters:
id- unique operation ID ornull.requestProducer- the request producer.responseConsumer- the response consumer.pushHandlerFactory- the push handler factory.context- the execution context.callback- the result callback.- Returns:
- the result future.
-
execute
public final <T> Future<T> execute(String id, 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) Initiates message exchange using the given request producer and response consumer.- Type Parameters:
T- the result representation.- Parameters:
id- unique operation ID ornull.requestProducer- the request producer.responseConsumer- the response consumer.context- the execution context.callback- the result callback.- Returns:
- the result future.
-
execute
public final <T> Future<T> execute(String id, 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.concurrent.FutureCallback<T> callback) Initiates message exchange using the given request producer and response consumer.- Type Parameters:
T- the result representation.- Parameters:
id- unique operation ID ornull.requestProducer- the request producer.responseConsumer- the response consumer.pushHandlerFactory- the push handler factory.callback- the result callback.- Returns:
- the result future.
-
execute
public final <T> Future<T> execute(String id, 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) Initiates message exchange using the given request producer and response consumer.- Type Parameters:
T- the result representation.- Parameters:
id- unique operation ID ornull.requestProducer- the request producer.responseConsumer- the response consumer.callback- the result callback.- Returns:
- the result future.
-
getInfo
Returns information about the endpoint ornullwhen not connected.- Since:
- 5.4
-