| Modifier and Type | Class and Description |
|---|---|
| private class | BufferingSubscriber.
Subscription that is passed to the downstream subscriber. |
| Modifier and Type | Field and Description |
|---|---|
| private long | accumulatedBytes
The actual accumulated remaining bytes in internalBuffers. |
| pack-priv static final int | |
| private final int | bufferSize
The amount of data to be accumulate before pushing downstream. |
| private final Object | buffersLock
Must be held when accessing the internal buffers. |
| pack-priv static final int | |
| pack-priv static final int | |
| private final HttpResponse. | downstreamSubscriber
The downstream consumer of the data. |
| private volatile BufferingSubscriber | downstreamSubscription
The downstream subscription, created lazily. |
| pack-priv static final int | |
| private ArrayList | internalBuffers
The internal buffers holding the buffered data. |
| private volatile int | |
| private volatile Flow. | subscription
The subscription, created lazily. |
| private volatile Throwable | throwable
Holds the Throwable from upstream's onError. |
| pack-priv static final int | UNSUBSCRIBED
State of the buffering subscriber: 1) [UNSUBSCRIBED] when initially created 2) [ACTIVE] when subscribed and can receive data 3) [ERROR | CANCELLED | COMPLETE] (terminal state) |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private List | fromInternalBuffers()
Returns a new, unmodifiable, List<ByteBuffer> containing exactly the amount of data as required before pushing downstream. |
| public CompletionStage | getBody()
Implements java. Returns a |
| private final boolean | hasEnoughAccumulatedBytes()
Tells whether, or not, there is at least a sufficient number of bytes accumulated in the internal buffers. |
| public boolean | needsExecutor()
Overrides default jdk. Returns true if getBody() should be called asynchronously. |
| public void | onComplete()
Implements java. Method invoked when it is known that no additional Subscriber method invocations will occur for a Subscription that is not already terminated by error, after which no other Subscriber methods are invoked by the Subscription. |
| public void | onError(Throwable incomingThrowable)
Implements java. Method invoked upon an unrecoverable error encountered by a Publisher or Subscription, after which no other Subscriber methods are invoked by the Subscription. |
| public void | onNext(List<ByteBuffer> item)
Implements java. Method invoked with a Subscription's next item. |
| public void | onSubscribe(Flow.
Implements java. Method invoked prior to invoking any other Subscriber methods for the given Subscription. |
| private static final long |
| accumulatedBytes | back to summary |
|---|---|
| private long accumulatedBytes The actual accumulated remaining bytes in internalBuffers. | |
| ACTIVE | back to summary |
|---|---|
| pack-priv static final int ACTIVE | |
| bufferSize | back to summary |
|---|---|
| private final int bufferSize The amount of data to be accumulate before pushing downstream. | |
| buffersLock | back to summary |
|---|---|
| private final Object buffersLock Must be held when accessing the internal buffers. | |
| CANCELLED | back to summary |
|---|---|
| pack-priv static final int CANCELLED | |
| COMPLETE | back to summary |
|---|---|
| pack-priv static final int COMPLETE | |
| downstreamSubscriber | back to summary |
|---|---|
| private final HttpResponse. The downstream consumer of the data. | |
| downstreamSubscription | back to summary |
|---|---|
| private volatile BufferingSubscriber<T>. The downstream subscription, created lazily. | |
| ERROR | back to summary |
|---|---|
| pack-priv static final int ERROR | |
| internalBuffers | back to summary |
|---|---|
| private ArrayList<ByteBuffer> internalBuffers The internal buffers holding the buffered data. | |
| state | back to summary |
|---|---|
| private volatile int state | |
| subscription | back to summary |
|---|---|
| private volatile Flow. The subscription, created lazily. | |
| throwable | back to summary |
|---|---|
| private volatile Throwable throwable Holds the Throwable from upstream's onError. | |
| UNSUBSCRIBED | back to summary |
|---|---|
| pack-priv static final int UNSUBSCRIBED State of the buffering subscriber: 1) [UNSUBSCRIBED] when initially created 2) [ACTIVE] when subscribed and can receive data 3) [ERROR | CANCELLED | COMPLETE] (terminal state) | |
| BufferingSubscriber | back to summary |
|---|---|
| public BufferingSubscriber(HttpResponse. | |
| fromInternalBuffers | back to summary |
|---|---|
| private List Returns a new, unmodifiable, List<ByteBuffer> containing exactly the amount of data as required before pushing downstream. The amount of data may be less than required ( bufferSize ), in the case where the subscriber is COMPLETE. | |
| getBody | back to summary |
|---|---|
| public CompletionStage Implements java. Doc from java. Returns a
| |
| hasEnoughAccumulatedBytes | back to summary |
|---|---|
| private final boolean hasEnoughAccumulatedBytes() Tells whether, or not, there is at least a sufficient number of bytes accumulated in the internal buffers. If the subscriber is COMPLETE, and has some buffered data, then there is always enough ( to pass downstream ). | |
| needsExecutor | back to summary |
|---|---|
| public boolean needsExecutor() Overrides default jdk. Doc from jdk. Returns true if getBody() should be called asynchronously.
| |
| onComplete | back to summary |
|---|---|
| public void onComplete() Implements java. Doc from java. Method invoked when it is known that no additional Subscriber method invocations will occur for a Subscription that is not already terminated by error, after which no other Subscriber methods are invoked by the Subscription. If this method throws an exception, resulting behavior is undefined.
| |
| onError | back to summary |
|---|---|
| public void onError(Throwable incomingThrowable) Implements java. Doc from java. Method invoked upon an unrecoverable error encountered by a Publisher or Subscription, after which no other Subscriber methods are invoked by the Subscription. If this method itself throws an exception, resulting behavior is undefined.
| |
| onNext | back to summary |
|---|---|
| public void onNext(List<ByteBuffer> item) Implements java. Doc from java. Method invoked with a Subscription's next item. If this method throws an exception, resulting behavior is not guaranteed, but may cause the Subscription to be cancelled.
| |
| onSubscribe | back to summary |
|---|---|
| public void onSubscribe(Flow. Implements java. Doc from java. Method invoked prior to invoking any other Subscriber methods for the given Subscription. If this method throws an exception, resulting behavior is not guaranteed, but may cause the Subscription not to be established or to be cancelled. Typically, implementations of this method invoke
| |
| remaining | back to summary |
|---|---|
| private static final long remaining(List<ByteBuffer> buffers) Returns the number of bytes remaining in the given buffers. | |
| Modifier and Type | Class and Description |
|---|---|
| pack-priv class |
| Modifier and Type | Field and Description |
|---|---|
| private final AtomicBoolean | |
| private final Demand | |
| private volatile boolean | |
| private final SequentialScheduler |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | cancel()
Implements java. Causes the Subscriber to (eventually) stop receiving messages. |
| pack-priv void | |
| public void | request(long n)
Implements java. Adds the given number |
| cancelled | back to summary |
|---|---|
| private final AtomicBoolean cancelled | |
| demand | back to summary |
|---|---|
| private final Demand demand | |
| illegalArg | back to summary |
|---|---|
| private volatile boolean illegalArg | |
| pushDemandedScheduler | back to summary |
|---|---|
| private final SequentialScheduler pushDemandedScheduler | |
| DownstreamSubscription | back to summary |
|---|---|
| private DownstreamSubscription() | |
| cancel | back to summary |
|---|---|
| public void cancel() Implements java. Doc from java. Causes the Subscriber to (eventually) stop receiving
messages. Implementation is best-effort -- additional
messages may be received after invoking this method.
A cancelled subscription need not ever receive an
| |
| pushDemanded | back to summary |
|---|---|
| pack-priv void pushDemanded() | |
| request | back to summary |
|---|---|
| public void request(long n) Implements java. Doc from java. Adds the given number
| |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | run()
Implements abstract jdk. The body of the task. |
| PushDemandedTask | back to summary |
|---|---|
| pack-priv PushDemandedTask() | |
| run | back to summary |
|---|---|
| public void run() Implements abstract jdk. Doc from jdk. The body of the task.
| |