@Experimental public class ClassicToAsyncRequestProducer extends Object implements AsyncRequestProducer
| Modifier and Type | Class and Description |
|---|---|
static interface |
ClassicToAsyncRequestProducer.IORunnable |
| Constructor and Description |
|---|
ClassicToAsyncRequestProducer(ClassicHttpRequest request,
int initialBufferSize,
Timeout timeout) |
ClassicToAsyncRequestProducer(ClassicHttpRequest request,
Timeout timeout) |
| Modifier and Type | Method and Description |
|---|---|
int |
available()
Returns the number of bytes immediately available for output.
|
ClassicToAsyncRequestProducer.IORunnable |
blockWaiting() |
void |
failed(Exception cause)
Triggered to signal a failure in data generation.
|
boolean |
isRepeatable()
Tests whether the producer can consistently produce the same content
after invocation of
ResourceHolder.releaseResources(). |
void |
produce(DataStreamChannel channel)
Triggered to signal the ability of the underlying data channel
to accept more data.
|
void |
releaseResources() |
void |
sendRequest(RequestChannel channel,
HttpContext context)
Triggered to signal the ability of the underlying request channel
to accept a request messages.
|
public ClassicToAsyncRequestProducer(ClassicHttpRequest request, int initialBufferSize, Timeout timeout)
public ClassicToAsyncRequestProducer(ClassicHttpRequest request, Timeout timeout)
public ClassicToAsyncRequestProducer.IORunnable blockWaiting() throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void sendRequest(RequestChannel channel, HttpContext context) throws HttpException, IOException
AsyncRequestProducersendRequest in interface AsyncRequestProducerchannel - the request channel capable to accepting a request message.context - the actual execution context.HttpException - in case of an HTTP protocol violation.IOException - in case of an I/O error.public boolean isRepeatable()
AsyncRequestProducerResourceHolder.releaseResources().isRepeatable in interface AsyncRequestProducerpublic int available()
AsyncDataProducer
Please note this method should return zero if the data producer
is unable to produce any more data, in which case
AsyncDataProducer.produce(DataStreamChannel) method will not get triggered.
The producer can resume writing out data asynchronously
once more data becomes available or request output readiness events
with DataStreamChannel.requestOutput().
available in interface AsyncDataProducerAsyncDataProducer.produce(DataStreamChannel),
DataStreamChannel.requestOutput()public void produce(DataStreamChannel channel) throws IOException
AsyncDataProducer
Please note this method gets triggered only if AsyncDataProducer.available()
returns a positive value.
produce in interface AsyncDataProducerchannel - the data channel capable of accepting more data.IOException - in case of an I/O error.AsyncDataProducer.available()public void failed(Exception cause)
AsyncRequestProducerfailed in interface AsyncRequestProducercause - the cause of the failure.public void releaseResources()
releaseResources in interface ResourceHolderCopyright © 2005–2021 The Apache Software Foundation. All rights reserved.