Top Inners Fields Constructors Methods
rx.internal.operators

public Class OperatorOnBackpressureBuffer<T>

extends Object
implements Observable.Operator<T, T>
Class Inheritance
All Implemented Interfaces
rx.Observable.Operator, rx.functions.Func1, rx.functions.Function
Static Imports
rx.BackpressureOverflow.ON_OVERFLOW_DEFAULT

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private final Long
private final Action0
private final BackpressureOverflow.Strategy

Constructor Summary

AccessConstructor and Description
pack-priv
public
OperatorOnBackpressureBuffer(long
the max number of items to be admitted in the buffer, must be greater than 0.
capacity
)

Construct a new instance that will handle overflows with ON_OVERFLOW_DEFAULT, providing the following behavior config:

public
OperatorOnBackpressureBuffer(long
the max number of items to be admitted in the buffer, must be greater than 0.
capacity
,
Action0
the Action0 to execute when the buffer overflows, may be null.
onOverflow
)

Construct a new instance that will handle overflows with ON_OVERFLOW_DEFAULT, providing the following behavior config:

public
OperatorOnBackpressureBuffer(long
the max number of items to be admitted in the buffer, must be greater than 0.
capacity
,
Action0
the Action0 to execute when the buffer overflows, may be null.
onOverflow
,
BackpressureOverflow.Strategy
the BackpressureOverflow.Strategy to handle overflows, it must not be null.
overflowStrategy
)

Construct a new instance feeding the following behavior config:

Method Summary

Modifier and TypeMethod and Description
public Subscriber<? super T>
call(final Subscriber<? super T> child)

Implements rx.functions.Func1.call.

public static <T> OperatorOnBackpressureBuffer<T>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

capacityback to summary
private final Long capacity
onOverflowback to summary
private final Action0 onOverflow
overflowStrategyback to summary
private final BackpressureOverflow.Strategy overflowStrategy

Constructor Detail

OperatorOnBackpressureBufferback to summary
pack-priv OperatorOnBackpressureBuffer()
OperatorOnBackpressureBufferback to summary
public OperatorOnBackpressureBuffer(long capacity)

Construct a new instance that will handle overflows with ON_OVERFLOW_DEFAULT, providing the following behavior config:

Parameters
capacity:long

the max number of items to be admitted in the buffer, must be greater than 0.

OperatorOnBackpressureBufferback to summary
public OperatorOnBackpressureBuffer(long capacity, Action0 onOverflow)

Construct a new instance that will handle overflows with ON_OVERFLOW_DEFAULT, providing the following behavior config:

Parameters
capacity:long

the max number of items to be admitted in the buffer, must be greater than 0.

onOverflow:Action0

the Action0 to execute when the buffer overflows, may be null.

OperatorOnBackpressureBufferback to summary
public OperatorOnBackpressureBuffer(long capacity, Action0 onOverflow, BackpressureOverflow.Strategy overflowStrategy)

Construct a new instance feeding the following behavior config:

Parameters
capacity:long

the max number of items to be admitted in the buffer, must be greater than 0.

onOverflow:Action0

the Action0 to execute when the buffer overflows, may be null.

overflowStrategy:BackpressureOverflow.Strategy

the BackpressureOverflow.Strategy to handle overflows, it must not be null.

Method Detail

callback to summary
public Subscriber<? super T> call(final Subscriber<? super T> child)

Implements rx.functions.Func1.call.

Annotations
@Override
instanceback to summary
public static <T> OperatorOnBackpressureBuffer<T> instance()
Annotations
@SuppressWarnings:unchecked
rx.internal.operators back to summary

pack-priv final Class OperatorOnBackpressureBuffer.BufferSubscriber<T>

extends Subscriber<T>
implements BackpressureQueueCallback
Class Inheritance
All Implemented Interfaces
rx.internal.util.BackpressureDrainManager.BackpressureQueueCallback

Field Summary

Modifier and TypeField and Description
private final AtomicLong
private final Subscriber<? super T>
private final BackpressureDrainManager
private final Action0
private final BackpressureOverflow.Strategy
private final ConcurrentLinkedQueue<Object>
private final AtomicBoolean

Constructor Summary

AccessConstructor and Description
public
BufferSubscriber(final Subscriber<? super T> child, Long capacity, Action0 onOverflow, BackpressureOverflow.Strategy overflowStrategy)

Method Summary

Modifier and TypeMethod and Description
public boolean
accept(Object
the value to deliver, not null
value
)

Implements rx.internal.util.BackpressureDrainManager.BackpressureQueueCallback.accept.

Override this method to deliver an element to downstream.
private boolean
public void
complete(Throwable
if not null, contains the terminal exception
exception
)

Implements rx.internal.util.BackpressureDrainManager.BackpressureQueueCallback.complete.

Override this method to deliver a normal or exceptional terminal event.
protected Producer
public void
onCompleted()

Implements rx.Observer.onCompleted.

Notifies the Observer that the Observable has finished sending push-based notifications.
public void
onError(Throwable
the exception encountered by the Observable
e
)

Implements rx.Observer.onError.

Notifies the Observer that the Observable has experienced an error condition.
public void
onNext(T
the item emitted by the Observable
t
)

Implements rx.Observer.onNext.

Provides the Observer with a new item to observe.
public void
onStart()

Overrides rx.Subscriber.onStart.

This method is invoked when the Subscriber and Observable have been connected but the Observable has not yet begun to emit items or send notifications to the Subscriber.
public Object
peek()

Implements rx.internal.util.BackpressureDrainManager.BackpressureQueueCallback.peek.

Override this method to peek for the next element, null meaning no next element available now.
public Object
poll()

Implements rx.internal.util.BackpressureDrainManager.BackpressureQueueCallback.poll.

Override this method to poll (consume) the next element, null meaning no next element available now.
Inherited from rx.Subscriber:
addisUnsubscribedrequestsetProducerunsubscribe

Field Detail

capacityback to summary
private final AtomicLong capacity
childback to summary
private final Subscriber<? super T> child
managerback to summary
private final BackpressureDrainManager manager
onOverflowback to summary
private final Action0 onOverflow
overflowStrategyback to summary
private final BackpressureOverflow.Strategy overflowStrategy
queueback to summary
private final ConcurrentLinkedQueue<Object> queue
saturatedback to summary
private final AtomicBoolean saturated

Constructor Detail

BufferSubscriberback to summary
public BufferSubscriber(final Subscriber<? super T> child, Long capacity, Action0 onOverflow, BackpressureOverflow.Strategy overflowStrategy)

Method Detail

acceptback to summary
public boolean accept(Object value)

Implements rx.internal.util.BackpressureDrainManager.BackpressureQueueCallback.accept.

Doc from rx.internal.util.BackpressureDrainManager.BackpressureQueueCallback.accept.

Override this method to deliver an element to downstream. The logic ensures that this happens only in the right conditions.

Parameters
value:Object

the value to deliver, not null

Returns:boolean

true indicates that one should terminate the emission loop unconditionally and not deliver any further elements or terminal events.

Annotations
@Override
assertCapacityback to summary
private boolean assertCapacity()
completeback to summary
public void complete(Throwable exception)

Implements rx.internal.util.BackpressureDrainManager.BackpressureQueueCallback.complete.

Doc from rx.internal.util.BackpressureDrainManager.BackpressureQueueCallback.complete.

Override this method to deliver a normal or exceptional terminal event.

Parameters
exception:Throwable

if not null, contains the terminal exception

Annotations
@Override
managerback to summary
protected Producer manager()
onCompletedback to summary
public void onCompleted()

Implements rx.Observer.onCompleted.

Doc from rx.Observer.onCompleted.

Notifies the Observer that the Observable has finished sending push-based notifications.

The Observable will not call this method if it calls onError.

Annotations
@Override
onErrorback to summary
public void onError(Throwable e)

Implements rx.Observer.onError.

Doc from rx.Observer.onError.

Notifies the Observer that the Observable has experienced an error condition.

If the Observable calls this method, it will not thereafter call onNext or onCompleted.

Parameters
e:Throwable

the exception encountered by the Observable

Annotations
@Override
onNextback to summary
public void onNext(T t)

Implements rx.Observer.onNext.

Doc from rx.Observer.onNext.

Provides the Observer with a new item to observe.

The Observable may call this method 0 or more times.

The Observable will not call this method again after it calls either onCompleted or onError.

Parameters
t:T

the item emitted by the Observable

Annotations
@Override
onStartback to summary
public void onStart()

Overrides rx.Subscriber.onStart.

Doc from rx.Subscriber.onStart.

This method is invoked when the Subscriber and Observable have been connected but the Observable has not yet begun to emit items or send notifications to the Subscriber. Override this method to add any useful initialization to your subscription, for instance to initiate backpressure.

Annotations
@Override
peekback to summary
public Object peek()

Implements rx.internal.util.BackpressureDrainManager.BackpressureQueueCallback.peek.

Doc from rx.internal.util.BackpressureDrainManager.BackpressureQueueCallback.peek.

Override this method to peek for the next element, null meaning no next element available now.

It will be called plain and while holding this object's monitor.

Returns:Object

the next element or null if no next element available

Annotations
@Override
pollback to summary
public Object poll()

Implements rx.internal.util.BackpressureDrainManager.BackpressureQueueCallback.poll.

Doc from rx.internal.util.BackpressureDrainManager.BackpressureQueueCallback.poll.

Override this method to poll (consume) the next element, null meaning no next element available now.

Returns:Object

the next element or null if no next element available

Annotations
@Override
rx.internal.operators back to summary

pack-priv final Class OperatorOnBackpressureBuffer.Holder

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv static final OperatorOnBackpressureBuffer<?>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
pack-priv static final OperatorOnBackpressureBuffer<?> INSTANCE

Constructor Detail

Holderback to summary
pack-priv Holder()