Top Description Methods
rx

public Interface Producer

Known Direct Implementers
rx.internal.operators.CachedObservable.ReplayProducer, rx.internal.operators.OperatorEagerConcatMap.EagerOuterProducer, rx.internal.operators.OperatorElementAt.InnerProducer, rx.internal.operators.OperatorGroupBy.GroupByProducer, rx.internal.operators.OperatorGroupBy.State, rx.internal.operators.OperatorGroupByEvicting.GroupByProducer, rx.internal.operators.OperatorGroupByEvicting.State, rx.internal.operators.OperatorMerge.MergeProducer, rx.internal.operators.OperatorOnBackpressureLatest.LatestEmitter, rx.internal.operators.OperatorPublish.InnerProducer, rx.internal.operators.OnSubscribeFlatMapSingle.FlatMapSingleSubscriber.Requested, rx.internal.operators.OnSubscribeFromArray.FromArrayProducer, rx.internal.operators.OnSubscribeFromIterable.IterableProducer, rx.internal.operators.OnSubscribePublishMulticast.PublishProducer, rx.internal.operators.OnSubscribeRange.RangeProducer, rx.internal.operators.OperatorWindowWithSize.WindowSkip.WindowSkipProducer, rx.internal.operators.OperatorWindowWithSize.WindowOverlap.WindowOverlapProducer, rx.internal.operators.OperatorZip.ZipProducer, rx.internal.operators.OperatorReplay.InnerProducer, rx.internal.operators.OperatorBufferWithSize.BufferSkip.BufferSkipProducer, rx.internal.operators.OperatorBufferWithSize.BufferOverlap.BufferOverlapProducer, rx.internal.operators.OperatorScan.InitialProducer, rx.internal.operators.DeferredScalarSubscriber.InnerProducer, rx.internal.operators.OnSubscribeCombineLatest.LatestCoordinator, rx.internal.operators.OnSubscribeConcatMap.ConcatMapInnerScalarProducer, rx.internal.operators.OnSubscribeCreate.BaseEmitter, rx.internal.operators.OnSubscribeDetach.DetachProducer, rx.internal.operators.OnSubscribeDetach.TerminatedProducer, rx.internal.producers.ProducerArbiter, rx.internal.producers.ProducerObserverArbiter, rx.internal.producers.QueuedProducer, rx.internal.producers.QueuedValueProducer, rx.internal.producers.SingleDelayedProducer, rx.internal.producers.SingleProducer, rx.internal.util.BackpressureDrainManager, rx.internal.util.ScalarSynchronousObservable.ScalarAsyncProducer, rx.internal.util.ScalarSynchronousObservable.WeakSingleProducer, rx.observables.AsyncOnSubscribe.AsyncOuterManager, rx.observables.SyncOnSubscribe.SubscriptionProducer, rx.subjects.PublishSubject.PublishSubjectProducer, rx.subjects.ReplaySubject.ReplayProducer, rx.subjects.UnicastSubject.State

Interface that establishes a request-channel between an Observable and a Subscriber and allows the Subscriber to request a certain amount of items from the Observable (otherwise known as backpressure).

The request amount only affects calls to Subscriber#onNext(Object); onError and onCompleted may appear without requests.

However, backpressure is somewhat optional in RxJava 1.x and Subscribers may not receive a Producer via their Subscriber#setProducer(Producer) method and will run in unbounded mode. Depending on the chain of operators, this can lead to rx.exceptions.MissingBackpressureException.

Method Summary

Modifier and TypeMethod and Description
public void
request(long
the maximum number of items you want this Producer to produce, or Long.MAX_VALUE if you want the Producer to produce items at its own pace
n
)

Request a certain maximum number of items from this Producer.

Method Detail

requestback to summary
public void request(long n)

Request a certain maximum number of items from this Producer. This is a way of requesting backpressure. To disable backpressure, pass Long.MAX_VALUE to this method.

Requests are additive but if a sequence of requests totals more than Long.MAX_VALUE then Long.MAX_VALUE requests will be actioned and the extras may be ignored. Arriving at Long.MAX_VALUE by addition of requests cannot be assumed to disable backpressure. For example, the code below may result in Long.MAX_VALUE requests being actioned only.

request(100);
request(Long.MAX_VALUE-1);
Parameters
n:long

the maximum number of items you want this Producer to produce, or Long.MAX_VALUE if you want the Producer to produce items at its own pace

Exceptions
IllegalArgumentException:
if the request amount is negative