Package rx.subjects
Class SubjectSubscriptionManager.SubjectObserver<T>
java.lang.Object
rx.subjects.SubjectSubscriptionManager.SubjectObserver<T>
- Type Parameters:
T- the consumed value type of the actual Observer
- All Implemented Interfaces:
Observer<T>
- Enclosing class:
SubjectSubscriptionManager<T>
protected static final class SubjectSubscriptionManager.SubjectObserver<T>
extends Object
implements Observer<T>
Observer wrapping the actual Subscriber and providing various
emission facilities.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final Subscriber<? super T> The actual Observer.(package private) booleanIndicate that the observer has caught up.(package private) booleanGuarded by this.(package private) boolean(package private) booleanWas the emitFirst run? Guarded by this.private ObjectIndicate where the observer is at replaying.Guarded by this. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidaccept(Object n, NotificationLite<T> nl) Dispatches a NotificationLite value to the actual Observer.(package private) voidemitFirst(Object n, NotificationLite<T> nl) Tries to emit a NotificationLite value as the first value and drains the queue as long as possible.(package private) voidEmits the contents of the queue as long as there are values.(package private) voidemitNext(Object n, NotificationLite<T> nl) Emits the given NotificationLite value and prevents the emitFirst to run if not already run.<I> Iindex()Returns the stored index.voidSets a new index value.voidNotifies the Observer that theObservablehas finished sending push-based notifications.voidNotifies the Observer that theObservablehas experienced an error condition.voidProvides the Observer with a new item to observe.
-
Field Details
-
actual
The actual Observer. -
first
boolean firstWas the emitFirst run? Guarded by this. -
emitting
boolean emittingGuarded by this. -
queue
Guarded by this. -
fastPath
boolean fastPath -
caughtUp
volatile boolean caughtUpIndicate that the observer has caught up. -
index
Indicate where the observer is at replaying.
-
-
Constructor Details
-
SubjectObserver
-
-
Method Details
-
onNext
Description copied from interface:ObserverProvides the Observer with a new item to observe.The
Observablemay call this method 0 or more times.The
Observablewill not call this method again after it calls eitherObserver.onCompleted()orObserver.onError(java.lang.Throwable). -
onError
Description copied from interface:ObserverNotifies the Observer that theObservablehas experienced an error condition.If the
Observablecalls this method, it will not thereafter callObserver.onNext(T)orObserver.onCompleted(). -
onCompleted
public void onCompleted()Description copied from interface:ObserverNotifies the Observer that theObservablehas finished sending push-based notifications.The
Observablewill not call this method if it callsObserver.onError(java.lang.Throwable).- Specified by:
onCompletedin interfaceObserver<T>
-
emitNext
Emits the given NotificationLite value and prevents the emitFirst to run if not already run.- Parameters:
n- the NotificationLite valuenl- the type-appropriate notification lite object
-
emitFirst
Tries to emit a NotificationLite value as the first value and drains the queue as long as possible.- Parameters:
n- the NotificationLite valuenl- the type-appropriate notification lite object
-
emitLoop
Emits the contents of the queue as long as there are values.- Parameters:
localQueue- the initial queue contentscurrent- the current content to emitnl- the type-appropriate notification lite object
-
accept
Dispatches a NotificationLite value to the actual Observer.- Parameters:
n- the value to dispatchnl- the type-appropriate notification lite object
-
getActual
- Returns:
- the actual Observer.
-
index
public <I> I index()Returns the stored index.- Type Parameters:
I- the index type- Returns:
- the index value
-
index
Sets a new index value.- Parameters:
newIndex- the new index value
-