Class PipeliningClientExchangeHandler<T>

    • Constructor Detail

      • PipeliningClientExchangeHandler

        public PipeliningClientExchangeHandler​(java.util.List<? extends HttpAsyncRequestProducer> requestProducers,
                                               java.util.List<? extends HttpAsyncResponseConsumer<T>> responseConsumers,
                                               org.apache.http.concurrent.FutureCallback<java.util.List<T>> callback,
                                               org.apache.http.protocol.HttpContext localContext,
                                               NHttpClientConnection conn,
                                               org.apache.http.protocol.HttpProcessor httpPocessor,
                                               org.apache.http.ConnectionReuseStrategy connReuseStrategy)
        Creates new instance of PipeliningClientExchangeHandler.
        Parameters:
        requestProducers - the request producers.
        responseConsumers - the response consumers.
        callback - the future callback invoked when the operation is completed.
        localContext - the local execution context.
        conn - the actual connection.
        httpPocessor - the HTTP protocol processor.
        connReuseStrategy - the connection re-use strategy.
      • PipeliningClientExchangeHandler

        public PipeliningClientExchangeHandler​(java.util.List<? extends HttpAsyncRequestProducer> requestProducers,
                                               java.util.List<? extends HttpAsyncResponseConsumer<T>> responseConsumers,
                                               org.apache.http.protocol.HttpContext localContext,
                                               NHttpClientConnection conn,
                                               org.apache.http.protocol.HttpProcessor httpPocessor)
        Creates new instance of PipeliningClientExchangeHandler.
        Parameters:
        requestProducers - the request producers.
        responseConsumers - the response consumers.
        localContext - the local execution context.
        conn - the actual connection.
        httpPocessor - the HTTP protocol processor.
    • Method Detail

      • getFuture

        public java.util.concurrent.Future<java.util.List<T>> getFuture()
      • close

        public 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
      • generateRequest

        public org.apache.http.HttpRequest generateRequest()
                                                    throws java.io.IOException,
                                                           org.apache.http.HttpException
        Description copied from interface: HttpAsyncClientExchangeHandler
        Invoked to generate a HTTP request message head. The message is expected to implement the HttpEntityEnclosingRequest interface if it is to enclose a content entity. The HttpAsyncClientExchangeHandler.produceContent(ContentEncoder, IOControl) method will not be invoked if HttpEntityEnclosingRequest.getEntity() returns null.
        Specified by:
        generateRequest in interface HttpAsyncClientExchangeHandler
        Returns:
        HTTP request message.
        Throws:
        java.io.IOException - in case of an I/O error
        org.apache.http.HttpException - in case of HTTP protocol violation
      • produceContent

        public void produceContent​(ContentEncoder encoder,
                                   IOControl ioControl)
                            throws java.io.IOException
        Description copied from interface: HttpAsyncClientExchangeHandler
        Invoked to write out a chunk of content to the ContentEncoder. The IOControl interface can be used to suspend output event notifications if the producer is temporarily unable to produce more content.

        When all content is finished, the producer MUST call ContentEncoder.complete(). Failure to do so may cause the entity to be incorrectly delimited.

        Please note that the ContentEncoder object is not thread-safe and should only be used within the context of this method call. The IOControl object can be shared and used on other thread to resume output event notifications when more content is made available.

        Specified by:
        produceContent in interface HttpAsyncClientExchangeHandler
        Parameters:
        encoder - content encoder.
        ioControl - I/O control of the underlying connection.
        Throws:
        java.io.IOException - in case of an I/O error
      • consumeContent

        public void consumeContent​(ContentDecoder decoder,
                                   IOControl ioControl)
                            throws java.io.IOException
        Description copied from interface: HttpAsyncClientExchangeHandler
        Invoked to process a chunk of content from the ContentDecoder. The IOControl interface can be used to suspend input event notifications if the consumer is temporarily unable to process content.

        The consumer can use the ContentDecoder.isCompleted() method to find out whether or not the message content has been fully consumed.

        Please note that the ContentDecoder object is not thread-safe and should only be used within the context of this method call. The IOControl object can be shared and used on other thread to resume input event notifications when the consumer is capable of processing more content.

        Specified by:
        consumeContent in interface HttpAsyncClientExchangeHandler
        Parameters:
        decoder - content decoder.
        ioControl - I/O control of the underlying connection.
        Throws:
        java.io.IOException - in case of an I/O error
      • cancel

        public boolean cancel()
        Specified by:
        cancel in interface org.apache.http.concurrent.Cancellable