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:
java.io.Closeable,java.lang.AutoCloseable,org.apache.http.concurrent.Cancellable,org.apache.http.nio.protocol.HttpAsyncClientExchangeHandler
@Pipelined class PipeliningClientExchangeHandlerImpl<T> extends AbstractClientExchangeHandler
HttpAsyncClientExchangeHandlerimplementation 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
Fields Modifier and Type Field Description private org.apache.http.protocol.HttpProcessorhttpProcessorprivate org.apache.http.client.protocol.HttpClientContextlocalContextprivate java.util.Queue<org.apache.http.nio.protocol.HttpAsyncRequestProducer>requestProducerQueueprivate java.util.concurrent.atomic.AtomicReference<org.apache.http.nio.protocol.HttpAsyncRequestProducer>requestProducerRefprivate java.util.Queue<org.apache.http.HttpRequest>requestQueueprivate java.util.Queue<org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>>responseConsumerQueueprivate java.util.concurrent.atomic.AtomicReference<org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>>responseConsumerRefprivate org.apache.http.concurrent.BasicFuture<java.util.List<T>>resultFutureprivate java.util.Queue<T>resultQueueprivate org.apache.http.HttpHosttarget-
Fields inherited from class org.apache.http.impl.nio.client.AbstractClientExchangeHandler
log
-
-
Constructor Summary
Constructors Constructor Description PipeliningClientExchangeHandlerImpl(org.apache.commons.logging.Log log, org.apache.http.HttpHost target, java.util.List<? extends org.apache.http.nio.protocol.HttpAsyncRequestProducer> requestProducers, java.util.List<? extends org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>> responseConsumers, org.apache.http.client.protocol.HttpClientContext localContext, org.apache.http.concurrent.BasicFuture<java.util.List<T>> resultFuture, NHttpClientConnectionManager connmgr, org.apache.http.protocol.HttpProcessor httpProcessor, org.apache.http.ConnectionReuseStrategy connReuseStrategy, org.apache.http.conn.ConnectionKeepAliveStrategy keepaliveStrategy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabortConnection()private voidcloseConsumer(org.apache.http.nio.protocol.HttpAsyncResponseConsumer<?> responseConsumer)private voidcloseProducer(org.apache.http.nio.protocol.HttpAsyncRequestProducer requestProducer)voidconsumeContent(org.apache.http.nio.ContentDecoder decoder, org.apache.http.nio.IOControl ioctrl)(package private) booleanexecutionCancelled()(package private) voidexecutionFailed(java.lang.Exception ex)org.apache.http.HttpRequestgenerateRequest()voidinputTerminated()voidproduceContent(org.apache.http.nio.ContentEncoder encoder, org.apache.http.nio.IOControl ioctrl)(package private) voidreleaseResources()voidrequestCompleted()voidresponseCompleted()voidresponseReceived(org.apache.http.HttpResponse response)voidstart()-
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 Detail
-
target
private final org.apache.http.HttpHost target
-
requestProducerQueue
private final java.util.Queue<org.apache.http.nio.protocol.HttpAsyncRequestProducer> requestProducerQueue
-
responseConsumerQueue
private final java.util.Queue<org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>> responseConsumerQueue
-
requestQueue
private final java.util.Queue<org.apache.http.HttpRequest> requestQueue
-
resultQueue
private final java.util.Queue<T> resultQueue
-
localContext
private final org.apache.http.client.protocol.HttpClientContext localContext
-
resultFuture
private final org.apache.http.concurrent.BasicFuture<java.util.List<T>> resultFuture
-
httpProcessor
private final org.apache.http.protocol.HttpProcessor httpProcessor
-
requestProducerRef
private final java.util.concurrent.atomic.AtomicReference<org.apache.http.nio.protocol.HttpAsyncRequestProducer> requestProducerRef
-
responseConsumerRef
private final java.util.concurrent.atomic.AtomicReference<org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>> responseConsumerRef
-
-
Constructor Detail
-
PipeliningClientExchangeHandlerImpl
public PipeliningClientExchangeHandlerImpl(org.apache.commons.logging.Log log, org.apache.http.HttpHost target, java.util.List<? extends org.apache.http.nio.protocol.HttpAsyncRequestProducer> requestProducers, java.util.List<? extends org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>> responseConsumers, org.apache.http.client.protocol.HttpClientContext localContext, org.apache.http.concurrent.BasicFuture<java.util.List<T>> resultFuture, NHttpClientConnectionManager connmgr, org.apache.http.protocol.HttpProcessor httpProcessor, org.apache.http.ConnectionReuseStrategy connReuseStrategy, org.apache.http.conn.ConnectionKeepAliveStrategy keepaliveStrategy)
-
-
Method Detail
-
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:
releaseResourcesin classAbstractClientExchangeHandler
-
executionFailed
void executionFailed(java.lang.Exception ex)
- Specified by:
executionFailedin classAbstractClientExchangeHandler
-
executionCancelled
boolean executionCancelled()
- Specified by:
executionCancelledin classAbstractClientExchangeHandler
-
start
public void start() throws org.apache.http.HttpException, java.io.IOException- Throws:
org.apache.http.HttpExceptionjava.io.IOException
-
generateRequest
public org.apache.http.HttpRequest generateRequest() throws java.io.IOException, org.apache.http.HttpException- Throws:
java.io.IOExceptionorg.apache.http.HttpException
-
produceContent
public void produceContent(org.apache.http.nio.ContentEncoder encoder, org.apache.http.nio.IOControl ioctrl) throws java.io.IOException- Throws:
java.io.IOException
-
requestCompleted
public void requestCompleted()
-
responseReceived
public void responseReceived(org.apache.http.HttpResponse response) throws java.io.IOException, org.apache.http.HttpException- Throws:
java.io.IOExceptionorg.apache.http.HttpException
-
consumeContent
public void consumeContent(org.apache.http.nio.ContentDecoder decoder, org.apache.http.nio.IOControl ioctrl) throws java.io.IOException- Throws:
java.io.IOException
-
responseCompleted
public void responseCompleted() throws java.io.IOException, org.apache.http.HttpException- Throws:
java.io.IOExceptionorg.apache.http.HttpException
-
inputTerminated
public void inputTerminated()
-
abortConnection
public void abortConnection()
-
-