Class AsyncConnectionEndpoint

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, org.apache.hc.core5.io.ModalCloseable
    Direct Known Subclasses:
    PoolingAsyncClientConnectionManager.InternalConnectionEndpoint

    @Contract(threading=SAFE)
    public abstract class AsyncConnectionEndpoint
    extends java.lang.Object
    implements org.apache.hc.core5.io.ModalCloseable
    Client connection endpoint that can be used to execute message exchanges.
    Since:
    5.0
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      abstract void execute​(java.lang.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.
      void execute​(java.lang.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.
      <T> java.util.concurrent.Future<T> execute​(java.lang.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.
      <T> java.util.concurrent.Future<T> execute​(java.lang.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.
      <T> java.util.concurrent.Future<T> execute​(java.lang.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.
      <T> java.util.concurrent.Future<T> execute​(java.lang.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.
      EndpointInfo getInfo()
      Returns information about the endpoint or null when not connected.
      abstract boolean isConnected()
      Determines if the connection to the remote endpoint is still open and valid.
      abstract void setSocketTimeout​(org.apache.hc.core5.util.Timeout timeout)
      Sets socket timeout.
      • 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
    • Constructor Detail

      • AsyncConnectionEndpoint

        public AsyncConnectionEndpoint()
    • Method Detail

      • execute

        public abstract void execute​(java.lang.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 or null.
        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

        public final void close()
                         throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • execute

        public void execute​(java.lang.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 or null.
        exchangeHandler - the message exchange handler.
        context - the execution context.
      • execute

        public final <T> java.util.concurrent.Future<T> execute​(java.lang.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 or null.
        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> java.util.concurrent.Future<T> execute​(java.lang.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 or null.
        requestProducer - the request producer.
        responseConsumer - the response consumer.
        context - the execution context.
        callback - the result callback.
        Returns:
        the result future.
      • execute

        public final <T> java.util.concurrent.Future<T> execute​(java.lang.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 or null.
        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> java.util.concurrent.Future<T> execute​(java.lang.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 or null.
        requestProducer - the request producer.
        responseConsumer - the response consumer.
        callback - the result callback.
        Returns:
        the result future.
      • getInfo

        public EndpointInfo getInfo()
        Returns information about the endpoint or null when not connected.
        Since:
        5.4