Top Description Fields Constructors Methods
io.reactivex.rxjava3.internal.subscribers

public abstract Class SinglePostCompleteSubscriber<T, R>

extends AtomicLong
implements FlowableSubscriber<T>, Subscription
Class Inheritance
All Implemented Interfaces
org.reactivestreams.Subscription, io.reactivex.rxjava3.core.FlowableSubscriber, org.reactivestreams.Subscriber
Known Direct Subclasses
io.reactivex.rxjava3.internal.operators.flowable.FlowableMapNotification.MapNotificationSubscriber, io.reactivex.rxjava3.internal.operators.flowable.FlowableMaterialize.MaterializeSubscriber, io.reactivex.rxjava3.internal.operators.flowable.FlowableOnErrorReturn.OnErrorReturnSubscriber, io.reactivex.rxjava3.internal.operators.flowable.FlowableConcatWithMaybe.ConcatWithSubscriber, io.reactivex.rxjava3.internal.operators.flowable.FlowableConcatWithSingle.ConcatWithSubscriber
Type Parameters
<T>
the input value type
<R>
the output value type
Imports
java.util.concurrent.atomic.AtomicLong, org.reactivestreams.*, io.reactivex.rxjava3.core.FlowableSubscriber, io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper, io.reactivex.rxjava3.internal.util.BackpressureHelper

Relays signals from upstream according to downstream requests and allows signalling a final value followed by onComplete in a backpressure-aware manner.

Field Summary

Modifier and TypeField and Description
pack-priv static final long
COMPLETE_MASK

Masks out the 2^63 bit indicating a completed state.

protected final Subscriber<? super R>
downstream

The downstream consumer.

protected long
produced

Number of values emitted so far.

pack-priv static final long
REQUEST_MASK

Masks out the lower 63 bit holding the current request amount.

private static final long
protected Subscription
upstream

The upstream subscription.

protected R
value

Hides java.util.concurrent.atomic.AtomicLong.value.

The last value stored in case there is no request for it.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
cancel()

Implements org.reactivestreams.Subscription.cancel.

Request the Publisher to stop sending data and clean up resources.
protected final void
complete(R
the value to emit
n
)

Signals the given value and an onComplete if the downstream is ready to receive the final value.

protected void
onDrop(R
the value dropped
n
)

Called in case of multiple calls to complete.

public void
public final void
request(long
the strictly positive number of elements to requests to the upstream Publisher
n
)

Implements org.reactivestreams.Subscription.request.

No events will be sent by a Publisher until demand is signaled via this method.
Inherited from java.util.concurrent.atomic.AtomicLong:
accumulateAndGetaddAndGetcompareAndExchangecompareAndExchangeAcquirecompareAndExchangeReleasecompareAndSetdecrementAndGetdoubleValuefloatValuegetgetAcquiregetAndAccumulategetAndAddgetAndDecrementgetAndIncrementgetAndSetgetAndUpdategetOpaquegetPlainincrementAndGetintValuelazySetlongValuesetsetOpaquesetPlainsetReleasetoStringupdateAndGetweakCompareAndSetweakCompareAndSetAcquireweakCompareAndSetPlainweakCompareAndSetReleaseweakCompareAndSetVolatile

Field Detail

COMPLETE_MASKback to summary
pack-priv static final long COMPLETE_MASK

Masks out the 2^63 bit indicating a completed state.

downstreamback to summary
protected final Subscriber<? super R> downstream

The downstream consumer.

producedback to summary
protected long produced

Number of values emitted so far.

REQUEST_MASKback to summary
pack-priv static final long REQUEST_MASK

Masks out the lower 63 bit holding the current request amount.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.concurrent.atomic.AtomicLong.serialVersionUID.

upstreamback to summary
protected Subscription upstream

The upstream subscription.

valueback to summary
protected R value

Hides java.util.concurrent.atomic.AtomicLong.value.

The last value stored in case there is no request for it.

Constructor Detail

SinglePostCompleteSubscriberback to summary
public SinglePostCompleteSubscriber(Subscriber<? super R> downstream)

Method Detail

cancelback to summary
public void cancel()

Implements org.reactivestreams.Subscription.cancel.

Doc from org.reactivestreams.Subscription.cancel.

Request the Publisher to stop sending data and clean up resources.

Data may still be sent to meet previously signalled demand after calling cancel.

Annotations
@Override
completeback to summary
protected final void complete(R n)

Signals the given value and an onComplete if the downstream is ready to receive the final value.

Parameters
n:R

the value to emit

onDropback to summary
protected void onDrop(R n)

Called in case of multiple calls to complete.

Parameters
n:R

the value dropped

onSubscribeback to summary
public void onSubscribe(Subscription s)

Implements org.reactivestreams.Subscriber.onSubscribe.

Doc from org.reactivestreams.Subscriber.onSubscribe.

Invoked after calling Publisher#subscribe(Subscriber).

No data will start flowing until Subscription#request(long) is invoked.

It is the responsibility of this Subscriber instance to call Subscription#request(long) whenever more data is wanted.

The Publisher will send notifications only in response to Subscription#request(long).

Parameters
s:Subscription

the Subscription that allows requesting data via Subscription#request(long)

Annotations
@Override
requestback to summary
public final void request(long n)

Implements org.reactivestreams.Subscription.request.

Doc from org.reactivestreams.Subscription.request.

No events will be sent by a Publisher until demand is signaled via this method.

It can be called however often and whenever needed—but if the outstanding cumulative demand ever becomes Long.MAX_VALUE or more, it may be treated by the Publisher as "effectively unbounded".

Whatever has been requested can be sent by the Publisher so only signal demand for what can be safely handled.

A Publisher can send less than is requested if the stream ends but then must emit either Subscriber#onError(Throwable) or Subscriber#onComplete().

Parameters
n:long

the strictly positive number of elements to requests to the upstream Publisher

Annotations
@Override