Top Description Inners Constructors Methods
rx.internal.operators

public final Class OperatorOnBackpressureLatest<T>

extends Object
implements Observable.Operator<T, T>
Class Inheritance
All Implemented Interfaces
rx.Observable.Operator, rx.functions.Func1, rx.functions.Function
Type Parameters
<T>
the value type
Imports
java.util.concurrent.atomic.*, rx.*, .Observable.Operator

An operator which drops all but the last received value in case the downstream doesn't request more.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
OperatorOnBackpressureLatest.Holder

Holds a singleton instance initialized on class-loading.

pack-priv static class
OperatorOnBackpressureLatest.LatestEmitter<T>

A terminable producer which emits the latest items on request.

pack-priv static class

Constructor Summary

AccessConstructor and Description
public

Method Summary

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

Implements rx.functions.Func1.call.

public static <
the value type
T
>
OperatorOnBackpressureLatest<T>

Returns:

the single instanceof OperatorOnBackpressureLatest
instance
()

Returns a singleton instance of the OnBackpressureLatest operator since it is stateless.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

OperatorOnBackpressureLatestback to summary
public OperatorOnBackpressureLatest()

Method Detail

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

Implements rx.functions.Func1.call.

Annotations
@Override
instanceback to summary
public static <T> OperatorOnBackpressureLatest<T> instance()

Returns a singleton instance of the OnBackpressureLatest operator since it is stateless.

Parameters
<T>
the value type
Returns:OperatorOnBackpressureLatest<T>

the single instanceof OperatorOnBackpressureLatest

Annotations
@SuppressWarnings:unchecked
rx.internal.operators back to summary

pack-priv final Class OperatorOnBackpressureLatest.Holder

extends Object
Class Inheritance

Holds a singleton instance initialized on class-loading.

Field Summary

Modifier and TypeField and Description
pack-priv static final OperatorOnBackpressureLatest<Object>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
pack-priv static final OperatorOnBackpressureLatest<Object> INSTANCE

Constructor Detail

Holderback to summary
pack-priv Holder()
rx.internal.operators back to summary

pack-priv final Class OperatorOnBackpressureLatest.LatestEmitter<T>

extends AtomicLong
implements Producer, Subscription, Observer<T>
Class Inheritance
All Implemented Interfaces
rx.Observer, rx.Subscription, rx.Producer

A terminable producer which emits the latest items on request.

Field Summary

Modifier and TypeField and Description
pack-priv final Subscriber<? super T>
pack-priv volatile boolean
pack-priv boolean
emitting

Guarded by this.

pack-priv static final Object
pack-priv boolean
missed

Guarded by this.

pack-priv static final long
pack-priv OperatorOnBackpressureLatest.LatestSubscriber<? super T>
private static final long
pack-priv Throwable
terminal

Written before done, read after done.

pack-priv final AtomicReference<Object>

Constructor Summary

AccessConstructor and Description
public
LatestEmitter(Subscriber<? super T> child)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
emit()

public boolean
isUnsubscribed()

Implements rx.Subscription.isUnsubscribed.

Indicates whether this Subscription is currently unsubscribed.
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.
pack-priv long
produced(long n)

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
)

Implements rx.Producer.request.

Request a certain maximum number of items from this Producer.
public void
unsubscribe()

Implements rx.Subscription.unsubscribe.

Stops the receipt of notifications on the Subscriber that was registered when this Subscription was received.
Inherited from java.util.concurrent.atomic.AtomicLong:
accumulateAndGetaddAndGetcompareAndExchangecompareAndExchangeAcquirecompareAndExchangeReleasecompareAndSetdecrementAndGetdoubleValuefloatValuegetgetAcquiregetAndAccumulategetAndAddgetAndDecrementgetAndIncrementgetAndSetgetAndUpdategetOpaquegetPlainincrementAndGetintValuelazySetlongValuesetsetOpaquesetPlainsetReleasetoStringupdateAndGetweakCompareAndSetweakCompareAndSetAcquireweakCompareAndSetPlainweakCompareAndSetReleaseweakCompareAndSetVolatile

Field Detail

childback to summary
pack-priv final Subscriber<? super T> child
doneback to summary
pack-priv volatile boolean done
emittingback to summary
pack-priv boolean emitting

Guarded by this.

EMPTYback to summary
pack-priv static final Object EMPTY
missedback to summary
pack-priv boolean missed

Guarded by this.

NOT_REQUESTEDback to summary
pack-priv static final long NOT_REQUESTED
parentback to summary
pack-priv OperatorOnBackpressureLatest.LatestSubscriber<? super T> parent
serialVersionUIDback to summary
private static final long serialVersionUID

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

terminalback to summary
pack-priv Throwable terminal

Written before done, read after done.

valueback to summary
pack-priv final AtomicReference<Object> value

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

Constructor Detail

LatestEmitterback to summary
public LatestEmitter(Subscriber<? super T> child)

Method Detail

emitback to summary
pack-priv void emit()
isUnsubscribedback to summary
public boolean isUnsubscribed()

Implements rx.Subscription.isUnsubscribed.

Doc from rx.Subscription.isUnsubscribed.

Indicates whether this Subscription is currently unsubscribed.

Returns:boolean

true if this Subscription is currently unsubscribed, false otherwise

Annotations
@Override
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
producedback to summary
pack-priv long produced(long n)
requestback to summary
public void request(long n)

Implements rx.Producer.request.

Doc from rx.Producer.request.

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

Annotations
@Override
unsubscribeback to summary
public void unsubscribe()

Implements rx.Subscription.unsubscribe.

Doc from rx.Subscription.unsubscribe.

Stops the receipt of notifications on the Subscriber that was registered when this Subscription was received.

This allows deregistering an Subscriber before it has finished receiving all events (i.e. before onCompleted is called).

Annotations
@Override
rx.internal.operators back to summary

pack-priv final Class OperatorOnBackpressureLatest.LatestSubscriber<T>

extends Subscriber<T>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final OperatorOnBackpressureLatest.LatestEmitter<T>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
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.
pack-priv void
requestMore(long n)

Inherited from rx.Subscriber:
addisUnsubscribedrequestsetProducerunsubscribe

Field Detail

producerback to summary
private final OperatorOnBackpressureLatest.LatestEmitter<T> producer

Hides rx.Subscriber.producer.

Constructor Detail

LatestSubscriberback to summary
pack-priv LatestSubscriber(OperatorOnBackpressureLatest.LatestEmitter<T> producer)

Method Detail

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
requestMoreback to summary
pack-priv void requestMore(long n)