org.apache.hc.client5.http.nio

## Class AsyncConnectionEndpoint

- java.lang.Object
- - org.apache.hc.client5.http.nio.AsyncConnectionEndpoint

- All Implemented Interfaces:
    Closeable, AutoCloseable, ModalCloseable

      @Contract(threading=SAFE)
      public abstract class AsyncConnectionEndpoint
      extends Object
      implements ModalCloseable

  Client connection endpoint that can be used to execute message exchanges.
  Since:
    5.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AsyncConnectionEndpoint()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `abstract void` | `execute(String id, AsyncClientExchangeHandler exchangeHandler, HandlerFactory<AsyncPushConsumer> pushHandlerFactory, HttpContext context)` Initiates a message exchange using the given handler.
    `void` | `execute(String id, AsyncClientExchangeHandler exchangeHandler, HttpContext context)` Initiates a message exchange using the given handler.
    `<T> Future<T>` | `execute(String id, AsyncRequestProducer requestProducer, AsyncResponseConsumer<T> responseConsumer, FutureCallback<T> callback)` Initiates message exchange using the given request producer and response consumer.
    `<T> Future<T>` | `execute(String id, AsyncRequestProducer requestProducer, AsyncResponseConsumer<T> responseConsumer, HandlerFactory<AsyncPushConsumer> pushHandlerFactory, FutureCallback<T> callback)` Initiates message exchange using the given request producer and response consumer.
    `<T> Future<T>` | `execute(String id, AsyncRequestProducer requestProducer, AsyncResponseConsumer<T> responseConsumer, HandlerFactory<AsyncPushConsumer> pushHandlerFactory, HttpContext context, FutureCallback<T> callback)` Initiates message exchange using the given request producer and response consumer.
    `<T> Future<T>` | `execute(String id, AsyncRequestProducer requestProducer, AsyncResponseConsumer<T> responseConsumer, HttpContext context, FutureCallback<T> callback)` Initiates message exchange using the given request producer and response consumer.
    `abstract boolean` | `isConnected()` Determines if the connection to the remote endpoint is still open and valid.
    `abstract void` | `setSocketTimeout(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(String id,
                                       AsyncClientExchangeHandler exchangeHandler,
                                       HandlerFactory<AsyncPushConsumer> pushHandlerFactory,
                                       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(Timeout timeout)

      Sets socket timeout.
      Parameters:
        `timeout` - the socket timeout.

    - #### close

          public final void close()
                           throws IOException

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Throws:
        `IOException`

    - #### execute

          public void execute(String id,
                              AsyncClientExchangeHandler exchangeHandler,
                              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> Future<T> execute(String id,
                                             AsyncRequestProducer requestProducer,
                                             AsyncResponseConsumer<T> responseConsumer,
                                             HandlerFactory<AsyncPushConsumer> pushHandlerFactory,
                                             HttpContext context,
                                             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> Future<T> execute(String id,
                                             AsyncRequestProducer requestProducer,
                                             AsyncResponseConsumer<T> responseConsumer,
                                             HttpContext context,
                                             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> Future<T> execute(String id,
                                             AsyncRequestProducer requestProducer,
                                             AsyncResponseConsumer<T> responseConsumer,
                                             HandlerFactory<AsyncPushConsumer> pushHandlerFactory,
                                             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> Future<T> execute(String id,
                                             AsyncRequestProducer requestProducer,
                                             AsyncResponseConsumer<T> responseConsumer,
                                             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.

Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.