org.apache.hc.core5.http.nio

## Class AsyncClientEndpoint

- java.lang.Object
- - org.apache.hc.core5.http.nio.AsyncClientEndpoint

-     @Contract(threading=SAFE)
      public abstract class AsyncClientEndpoint
      extends Object

  Client endpoint leased from a connection manager.

  Once the endpoint is no longer needed it MUST be released with `releaseAndReuse()` or `releaseAndDiscard()`.

  Since:
    5.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AsyncClientEndpoint()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract void` | `execute(AsyncClientExchangeHandler exchangeHandler, HandlerFactory<AsyncPushConsumer> pushHandlerFactory, HttpContext context)` Initiates a message exchange using the given handler.
    `void` | `execute(AsyncClientExchangeHandler exchangeHandler, HttpContext context)` Initiates a message exchange using the given handler.
    `<T> Future<T>` | `execute(AsyncRequestProducer requestProducer, AsyncResponseConsumer<T> responseConsumer, FutureCallback<T> callback)` Initiates a message exchange using the given request producer and response consumer.
    `<T> Future<T>` | `execute(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(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` | `releaseAndDiscard()` Shuts down the underlying connection and removes it from the connection pool.
    `abstract void` | `releaseAndReuse()` Releases the underlying connection back to the connection pool as re-usable.

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

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

- - ### Constructor Detail

    - #### AsyncClientEndpoint

          public AsyncClientEndpoint()

  - ### Method Detail

    - #### execute

          public abstract void execute(AsyncClientExchangeHandler exchangeHandler,
                     HandlerFactory<AsyncPushConsumer> pushHandlerFactory,
                     HttpContext context)

      Initiates a message exchange using the given handler.

      Once the endpoint is no longer needed it MUST be released with `releaseAndReuse()` or `releaseAndDiscard()`.

    - #### execute

          public void execute(AsyncClientExchangeHandler exchangeHandler,
                     HttpContext context)

      Initiates a message exchange using the given handler.

      Once the endpoint is no longer needed it MUST be released with `releaseAndReuse()` or `releaseAndDiscard()`.

    - #### releaseAndReuse

          public abstract void releaseAndReuse()

      Releases the underlying connection back to the connection pool as re-usable.

    - #### releaseAndDiscard

          public abstract void releaseAndDiscard()

      Shuts down the underlying connection and removes it from the connection pool.

    - #### isConnected

          public abstract boolean isConnected()

      Determines if the connection to the remote endpoint is still open and valid.

    - #### execute

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

      Initiates message exchange using the given request producer and response consumer.

      Once the endpoint is no longer needed it MUST be released with `releaseAndReuse()` or `releaseAndDiscard()`.

    - #### execute

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

      Initiates message exchange using the given request producer and response consumer.

      Once the endpoint is no longer needed it MUST be released with `releaseAndReuse()` or `releaseAndDiscard()`.

    - #### execute

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

      Initiates a message exchange using the given request producer and response consumer.

      Once the endpoint is no longer needed it MUST be released with `releaseAndReuse()` or `releaseAndDiscard()`.

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