Top Description Fields Constructors Methods
org.apache.hc.core5.reactive

pack-priv final Class ReactiveDataConsumer

extends Object
implements AsyncDataConsumer, Publisher<ByteBuffer>
Class Inheritance
All Implemented Interfaces
org.reactivestreams.Publisher, org.apache.hc.core5.http.nio.AsyncDataConsumer, org.apache.hc.core5.http.nio.ResourceHolder
Annotations
@Contract
threading:SAFE
Imports
java.io.IOException, java.nio.ByteBuffer, java.util.List, java.util.concurrent.BlockingQueue, .LinkedBlockingQueue, java.util.concurrent.atomic.AtomicBoolean, .AtomicInteger, .AtomicLong, org.apache.hc.core5.annotation.Contract, .ThreadingBehavior, org.apache.hc.core5.http.Header, .HttpStreamResetException, org.apache.hc.core5.http.nio.AsyncDataConsumer, .CapacityChannel, org.apache.hc.core5.util.Args, org.reactivestreams.Publisher, .Subscriber, .Subscription

An asynchronous data consumer that supports Reactive Streams.
Since
5.0

Field Summary

Modifier and TypeField and Description
private final BlockingQueue<ByteBuffer>
private volatile boolean
private volatile CapacityChannel
private volatile boolean
private volatile Exception
private final AtomicBoolean
private final Object
private final AtomicLong
private volatile Subscriber<? super ByteBuffer>
private final AtomicInteger

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
consume(final ByteBuffer
data source.
byteBuffer
)

Implements org.apache.hc.core5.http.nio.AsyncDataConsumer.consume.

Triggered to pass incoming data to the data consumer.
public void
failed(final Exception cause)

private void
public void
private void
public void
streamEnd(final List<? extends Header>
data stream trailers.
trailers
)

Implements org.apache.hc.core5.http.nio.AsyncDataConsumer.streamEnd.

Triggered to signal termination of the data stream.
public void
subscribe(final Subscriber<? super ByteBuffer>
the Subscriber that will consume signals from this Publisher
subscriber
)

Implements org.reactivestreams.Publisher.subscribe.

Request Publisher to start streaming data.
private void
public void
updateCapacity(final CapacityChannel
the channel for capacity updates.
capacityChannel
)

Implements org.apache.hc.core5.http.nio.AsyncDataConsumer.updateCapacity.

Triggered to signal ability of the underlying data stream to receive data capacity update.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

buffersback to summary
private final BlockingQueue<ByteBuffer> buffers
cancelledback to summary
private volatile boolean cancelled
capacityChannelback to summary
private volatile CapacityChannel capacityChannel
completedback to summary
private volatile boolean completed
exceptionback to summary
private volatile Exception exception
flushInProgressback to summary
private final AtomicBoolean flushInProgress
flushLockback to summary
private final Object flushLock
requestsback to summary
private final AtomicLong requests
subscriberback to summary
private volatile Subscriber<? super ByteBuffer> subscriber
windowScalingIncrementback to summary
private final AtomicInteger windowScalingIncrement

Constructor Detail

ReactiveDataConsumerback to summary
pack-priv ReactiveDataConsumer()

Method Detail

consumeback to summary
public void consume(final ByteBuffer byteBuffer) throws IOException

Implements org.apache.hc.core5.http.nio.AsyncDataConsumer.consume.

Doc from org.apache.hc.core5.http.nio.AsyncDataConsumer.consume.

Triggered to pass incoming data to the data consumer. The consumer must consume the entire content of the data buffer. The consumer must stop incrementing its capacity on the capacity channel if it is unable to accept more data. Once the data consumer has handled accumulated data or allocated more intermediate storage it can update its capacity information on the capacity channel.

Parameters
byteBuffer:ByteBuffer

data source.

Annotations
@Override
failedback to summary
public void failed(final Exception cause)
flushToSubscriberback to summary
private void flushToSubscriber()
releaseResourcesback to summary
public void releaseResources()

Implements org.apache.hc.core5.http.nio.ResourceHolder.releaseResources.

Annotations
@Override
signalCapacityback to summary
private void signalCapacity(final CapacityChannel channel) throws IOException
streamEndback to summary
public void streamEnd(final List<? extends Header> trailers)

Implements org.apache.hc.core5.http.nio.AsyncDataConsumer.streamEnd.

Doc from org.apache.hc.core5.http.nio.AsyncDataConsumer.streamEnd.

Triggered to signal termination of the data stream.

Parameters
trailers:List<? extends Header>

data stream trailers.

Annotations
@Override
subscribeback to summary
public void subscribe(final Subscriber<? super ByteBuffer> subscriber)

Implements org.reactivestreams.Publisher.subscribe.

Doc from org.reactivestreams.Publisher.subscribe.

Request Publisher to start streaming data.

This is a "factory method" and can be called multiple times, each time starting a new Subscription.

Each Subscription will work for only a single Subscriber.

A Subscriber should only subscribe once to a single Publisher.

If the Publisher rejects the subscription attempt or otherwise fails it will signal the error via Subscriber#onError(Throwable).

Parameters
subscriber:Subscriber<? super ByteBuffer>

the Subscriber that will consume signals from this Publisher

Annotations
@Override
throwIfCancelledback to summary
private void throwIfCancelled() throws IOException
updateCapacityback to summary
public void updateCapacity(final CapacityChannel capacityChannel) throws IOException

Implements org.apache.hc.core5.http.nio.AsyncDataConsumer.updateCapacity.

Doc from org.apache.hc.core5.http.nio.AsyncDataConsumer.updateCapacity.

Triggered to signal ability of the underlying data stream to receive data capacity update. The data consumer can choose to write data immediately inside the call or asynchronously at some later point.

Parameters
capacityChannel:CapacityChannel

the channel for capacity updates.

Annotations
@Override