Class InternalHttpAsyncExecRuntime

    • Constructor Summary

      Constructors 
      Constructor Description
      InternalHttpAsyncExecRuntime​(org.slf4j.Logger log, AsyncClientConnectionManager manager, org.apache.hc.core5.reactor.ConnectionInitiator connectionInitiator, org.apache.hc.core5.http.nio.HandlerFactory<org.apache.hc.core5.http.nio.AsyncPushConsumer> pushHandlerFactory, TlsConfig tlsConfig)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.hc.core5.concurrent.Cancellable acquireEndpoint​(java.lang.String id, HttpRoute route, java.lang.Object object, HttpClientContext context, org.apache.hc.core5.concurrent.FutureCallback<AsyncExecRuntime> callback)
      Initiates operation to acquire a connection endpoint.
      org.apache.hc.core5.concurrent.Cancellable connectEndpoint​(HttpClientContext context, org.apache.hc.core5.concurrent.FutureCallback<AsyncExecRuntime> callback)
      Initiates operation to connect the local endpoint to the initial hop (connection target in case of a direct route or to the first proxy hop in case of a route via a proxy or multiple proxies).
      void discardEndpoint()
      Shuts down and discards the acquired endpoint.
      private void discardEndpoint​(AsyncConnectionEndpoint endpoint)  
      void disconnectEndpoint()
      Disconnects the local endpoint from the initial hop in the connection route.
      (package private) AsyncConnectionEndpoint ensureValid()  
      org.apache.hc.core5.concurrent.Cancellable execute​(java.lang.String id, org.apache.hc.core5.http.nio.AsyncClientExchangeHandler exchangeHandler, HttpClientContext context)
      Initiates a message exchange using the given handler.
      AsyncExecRuntime fork()
      Forks this runtime for parallel execution.
      boolean isEndpointAcquired()
      Determines of a connection endpoint has been acquired.
      boolean isEndpointConnected()
      Determines of there the endpoint is connected to the initial hop (connection target in case of a direct route or to the first proxy hop in case of a route via a proxy or multiple proxies).
      void markConnectionNonReusable()
      Marks the connection as non re-usable.
      void markConnectionReusable​(java.lang.Object newState, org.apache.hc.core5.util.TimeValue newValidDuration)
      Marks the connection as potentially re-usable for the given period of time and also marks it as stateful if the state representation is given.
      void releaseEndpoint()
      Releases the acquired endpoint potentially making it available for re-use.
      void upgradeTls​(HttpClientContext context)
      Upgrades transport security of the active connection by using the TLS security protocol.
      void upgradeTls​(HttpClientContext context, org.apache.hc.core5.concurrent.FutureCallback<AsyncExecRuntime> callback)
      Upgrades transport security of the active connection by using the TLS security protocol.
      boolean validateConnection()
      Validates the connection making sure it can be used to execute requests.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • log

        private final org.slf4j.Logger log
      • connectionInitiator

        private final org.apache.hc.core5.reactor.ConnectionInitiator connectionInitiator
      • pushHandlerFactory

        private final org.apache.hc.core5.http.nio.HandlerFactory<org.apache.hc.core5.http.nio.AsyncPushConsumer> pushHandlerFactory
      • tlsConfig

        @Deprecated
        private final TlsConfig tlsConfig
        Deprecated.
        TLS should be configured by the connection manager
      • reusable

        private volatile boolean reusable
      • state

        private volatile java.lang.Object state
      • validDuration

        private volatile org.apache.hc.core5.util.TimeValue validDuration
    • Constructor Detail

      • InternalHttpAsyncExecRuntime

        InternalHttpAsyncExecRuntime​(org.slf4j.Logger log,
                                     AsyncClientConnectionManager manager,
                                     org.apache.hc.core5.reactor.ConnectionInitiator connectionInitiator,
                                     org.apache.hc.core5.http.nio.HandlerFactory<org.apache.hc.core5.http.nio.AsyncPushConsumer> pushHandlerFactory,
                                     TlsConfig tlsConfig)
    • Method Detail

      • isEndpointAcquired

        public boolean isEndpointAcquired()
        Description copied from interface: AsyncExecRuntime
        Determines of a connection endpoint has been acquired.
        Specified by:
        isEndpointAcquired in interface AsyncExecRuntime
        Returns:
        true if an endpoint has been acquired, false otherwise.
      • acquireEndpoint

        public org.apache.hc.core5.concurrent.Cancellable acquireEndpoint​(java.lang.String id,
                                                                          HttpRoute route,
                                                                          java.lang.Object object,
                                                                          HttpClientContext context,
                                                                          org.apache.hc.core5.concurrent.FutureCallback<AsyncExecRuntime> callback)
        Description copied from interface: AsyncExecRuntime
        Initiates operation to acquire a connection endpoint. Endpoints can leased from a pool or unconnected new endpoint can be created.
        Specified by:
        acquireEndpoint in interface AsyncExecRuntime
        Parameters:
        id - unique operation ID or null.
        route - the connection route.
        object - the expected connection state. May be null if connection can be state-less or its state is irrelevant.
        context - the execution context.
        callback - the result callback.
        Returns:
        handle that can be used to cancel the operation.
      • releaseEndpoint

        public void releaseEndpoint()
        Description copied from interface: AsyncExecRuntime
        Releases the acquired endpoint potentially making it available for re-use.
        Specified by:
        releaseEndpoint in interface AsyncExecRuntime
      • validateConnection

        public boolean validateConnection()
        Description copied from interface: AsyncExecRuntime
        Validates the connection making sure it can be used to execute requests.
        Specified by:
        validateConnection in interface AsyncExecRuntime
        Returns:
        true if the connection is valid, false.
      • isEndpointConnected

        public boolean isEndpointConnected()
        Description copied from interface: AsyncExecRuntime
        Determines of there the endpoint is connected to the initial hop (connection target in case of a direct route or to the first proxy hop in case of a route via a proxy or multiple proxies).
        Specified by:
        isEndpointConnected in interface AsyncExecRuntime
        Returns:
        true if the endpoint is connected, false otherwise.
      • connectEndpoint

        public org.apache.hc.core5.concurrent.Cancellable connectEndpoint​(HttpClientContext context,
                                                                          org.apache.hc.core5.concurrent.FutureCallback<AsyncExecRuntime> callback)
        Description copied from interface: AsyncExecRuntime
        Initiates operation to connect the local endpoint to the initial hop (connection target in case of a direct route or to the first proxy hop in case of a route via a proxy or multiple proxies).
        Specified by:
        connectEndpoint in interface AsyncExecRuntime
        Parameters:
        context - the execution context.
        callback - the result callback.
        Returns:
        handle that can be used to cancel the operation.
      • disconnectEndpoint

        public void disconnectEndpoint()
        Description copied from interface: AsyncExecRuntime
        Disconnects the local endpoint from the initial hop in the connection route.
        Specified by:
        disconnectEndpoint in interface AsyncExecRuntime
      • upgradeTls

        public void upgradeTls​(HttpClientContext context)
        Description copied from interface: AsyncExecRuntime
        Upgrades transport security of the active connection by using the TLS security protocol.
        Specified by:
        upgradeTls in interface AsyncExecRuntime
        Parameters:
        context - the execution context.
      • upgradeTls

        public void upgradeTls​(HttpClientContext context,
                               org.apache.hc.core5.concurrent.FutureCallback<AsyncExecRuntime> callback)
        Description copied from interface: AsyncExecRuntime
        Upgrades transport security of the active connection by using the TLS security protocol.
        Specified by:
        upgradeTls in interface AsyncExecRuntime
        Parameters:
        context - the execution context.
      • execute

        public org.apache.hc.core5.concurrent.Cancellable execute​(java.lang.String id,
                                                                  org.apache.hc.core5.http.nio.AsyncClientExchangeHandler exchangeHandler,
                                                                  HttpClientContext context)
        Description copied from interface: AsyncExecRuntime
        Initiates a message exchange using the given handler.
        Specified by:
        execute in interface AsyncExecRuntime
        Parameters:
        id - unique operation ID or null.
        exchangeHandler - the client message handler.
        context - the execution context.
      • markConnectionReusable

        public void markConnectionReusable​(java.lang.Object newState,
                                           org.apache.hc.core5.util.TimeValue newValidDuration)
        Description copied from interface: AsyncExecRuntime
        Marks the connection as potentially re-usable for the given period of time and also marks it as stateful if the state representation is given.
        Specified by:
        markConnectionReusable in interface AsyncExecRuntime
        Parameters:
        newState - the connection state representation or null if stateless.
        newValidDuration - the period of time this connection is valid for.