Package org.apache.http.impl.nio.client
Class PipeliningClientExchangeHandlerImpl<T>
java.lang.Object
org.apache.http.impl.nio.client.AbstractClientExchangeHandler
org.apache.http.impl.nio.client.PipeliningClientExchangeHandlerImpl<T>
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.apache.http.concurrent.Cancellable
,org.apache.http.nio.protocol.HttpAsyncClientExchangeHandler
HttpAsyncClientExchangeHandler
implementation
that supports HTTP message pipelining.
Instances of this class are expected to be accessed by one thread at a time only.
The AbstractClientExchangeHandler.cancel()
method can be called concurrently by multiple threads.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.apache.http.protocol.HttpProcessor
private final org.apache.http.client.protocol.HttpClientContext
private final Queue
<org.apache.http.nio.protocol.HttpAsyncRequestProducer> private final AtomicReference
<org.apache.http.nio.protocol.HttpAsyncRequestProducer> private final Queue
<org.apache.http.HttpRequest> private final AtomicReference
<org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>> private final org.apache.http.HttpHost
Fields inherited from class org.apache.http.impl.nio.client.AbstractClientExchangeHandler
log
-
Constructor Summary
ConstructorsConstructorDescriptionPipeliningClientExchangeHandlerImpl
(org.apache.commons.logging.Log log, org.apache.http.HttpHost target, List<? extends org.apache.http.nio.protocol.HttpAsyncRequestProducer> requestProducers, List<? extends org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>> responseConsumers, org.apache.http.client.protocol.HttpClientContext localContext, org.apache.http.concurrent.BasicFuture<List<T>> resultFuture, NHttpClientConnectionManager connmgr, org.apache.http.protocol.HttpProcessor httpProcessor, org.apache.http.ConnectionReuseStrategy connReuseStrategy, org.apache.http.conn.ConnectionKeepAliveStrategy keepaliveStrategy) -
Method Summary
Modifier and TypeMethodDescriptionvoid
private void
closeConsumer
(org.apache.http.nio.protocol.HttpAsyncResponseConsumer<?> responseConsumer) private void
closeProducer
(org.apache.http.nio.protocol.HttpAsyncRequestProducer requestProducer) void
consumeContent
(org.apache.http.nio.ContentDecoder decoder, org.apache.http.nio.IOControl ioctrl) (package private) boolean
(package private) void
org.apache.http.HttpRequest
void
void
produceContent
(org.apache.http.nio.ContentEncoder encoder, org.apache.http.nio.IOControl ioctrl) (package private) void
void
void
void
responseReceived
(org.apache.http.HttpResponse response) void
start()
Methods inherited from class org.apache.http.impl.nio.client.AbstractClientExchangeHandler
cancel, close, discardConnection, failed, getActualRoute, getConnection, getCurrentRequest, getCurrentResponse, getId, getRoute, isCompleted, isDone, isRouteEstablished, manageConnectionPersistence, markCompleted, markConnectionNonReusable, onRouteComplete, onRouteToProxy, onRouteToTarget, onRouteTunnelToTarget, onRouteUpgrade, releaseConnection, requestConnection, setCurrentRequest, setCurrentResponse, setRoute, verifytRoute
-
Field Details
-
target
private final org.apache.http.HttpHost target -
requestProducerQueue
-
responseConsumerQueue
-
requestQueue
-
resultQueue
-
localContext
private final org.apache.http.client.protocol.HttpClientContext localContext -
resultFuture
-
httpProcessor
private final org.apache.http.protocol.HttpProcessor httpProcessor -
requestProducerRef
private final AtomicReference<org.apache.http.nio.protocol.HttpAsyncRequestProducer> requestProducerRef -
responseConsumerRef
private final AtomicReference<org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>> responseConsumerRef
-
-
Constructor Details
-
PipeliningClientExchangeHandlerImpl
public PipeliningClientExchangeHandlerImpl(org.apache.commons.logging.Log log, org.apache.http.HttpHost target, List<? extends org.apache.http.nio.protocol.HttpAsyncRequestProducer> requestProducers, List<? extends org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>> responseConsumers, org.apache.http.client.protocol.HttpClientContext localContext, org.apache.http.concurrent.BasicFuture<List<T>> resultFuture, NHttpClientConnectionManager connmgr, org.apache.http.protocol.HttpProcessor httpProcessor, org.apache.http.ConnectionReuseStrategy connReuseStrategy, org.apache.http.conn.ConnectionKeepAliveStrategy keepaliveStrategy)
-
-
Method Details
-
closeProducer
private void closeProducer(org.apache.http.nio.protocol.HttpAsyncRequestProducer requestProducer) -
closeConsumer
private void closeConsumer(org.apache.http.nio.protocol.HttpAsyncResponseConsumer<?> responseConsumer) -
releaseResources
void releaseResources()- Specified by:
releaseResources
in classAbstractClientExchangeHandler
-
executionFailed
- Specified by:
executionFailed
in classAbstractClientExchangeHandler
-
executionCancelled
boolean executionCancelled()- Specified by:
executionCancelled
in classAbstractClientExchangeHandler
-
start
- Throws:
org.apache.http.HttpException
IOException
-
generateRequest
public org.apache.http.HttpRequest generateRequest() throws IOException, org.apache.http.HttpException- Throws:
IOException
org.apache.http.HttpException
-
produceContent
public void produceContent(org.apache.http.nio.ContentEncoder encoder, org.apache.http.nio.IOControl ioctrl) throws IOException - Throws:
IOException
-
requestCompleted
public void requestCompleted() -
responseReceived
public void responseReceived(org.apache.http.HttpResponse response) throws IOException, org.apache.http.HttpException - Throws:
IOException
org.apache.http.HttpException
-
consumeContent
public void consumeContent(org.apache.http.nio.ContentDecoder decoder, org.apache.http.nio.IOControl ioctrl) throws IOException - Throws:
IOException
-
responseCompleted
- Throws:
IOException
org.apache.http.HttpException
-
inputTerminated
public void inputTerminated() -
abortConnection
public void abortConnection()
-