Top Description Fields Constructors Methods
io.reactivex.subjects

pack-priv final Class SerializedSubject<T>

extends Subject<T>
implements AppendOnlyLinkedArrayList.NonThrowingPredicate<Object>
Class Inheritance
All Implemented Interfaces
io.reactivex.internal.util.AppendOnlyLinkedArrayList.NonThrowingPredicate, io.reactivex.functions.Predicate
Type Parameters
<T>
the item value type
Imports
io.reactivex.Observer, io.reactivex.annotations.Nullable, io.reactivex.disposables.Disposable, io.reactivex.internal.util.*, .AppendOnlyLinkedArrayList.NonThrowingPredicate, io.reactivex.plugins.RxJavaPlugins

Serializes calls to the Observer methods.

All other Observable and Subject methods are thread-safe by design.

Field Summary

Modifier and TypeField and Description
pack-priv final Subject<T>
actual

The actual subscriber to serialize Subscriber calls to.

pack-priv volatile boolean
done

Indicates a terminal event has been received and all further events will be dropped.

pack-priv boolean
emitting

Indicates an emission is going on, guarded by this.

pack-priv AppendOnlyLinkedArrayList<Object>
queue

If not null, it holds the missed NotificationLite events.

Constructor Summary

AccessConstructor and Description
pack-priv
SerializedSubject(final Subject<T>
the subject wrapped
actual
)

Constructor that wraps an actual subject.

Method Summary

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

Loops until all notifications in the queue has been processed.

public Throwable
getThrowable()

Implements abstract io.reactivex.subjects.Subject.getThrowable.

Returns the error that caused the Subject to terminate or null if the Subject hasn't terminated yet.
public boolean
hasComplete()

Implements abstract io.reactivex.subjects.Subject.hasComplete.

Returns true if the subject has reached a terminal state through a complete event.
public boolean
hasObservers()

Implements abstract io.reactivex.subjects.Subject.hasObservers.

Returns true if the subject has any Observers.
public boolean
hasThrowable()

Implements abstract io.reactivex.subjects.Subject.hasThrowable.

Returns true if the subject has reached a terminal state through an error event.
public void
onComplete()

Implements io.reactivex.Observer.onComplete.

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

Implements io.reactivex.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 io.reactivex.Observer.onNext.

Provides the Observer with a new item to observe.
public void
onSubscribe(Disposable
the Disposable instance whose Disposable#dispose() can be called anytime to cancel the connection
d
)

Implements io.reactivex.Observer.onSubscribe.

Provides the Observer with the means of cancelling (disposing) the connection (channel) with the Observable in both synchronous (from within onNext(Object)) and asynchronous manner.
protected void
subscribeActual(Observer<? super T>
the incoming Observer, never null
observer
)

Implements abstract io.reactivex.Observable.subscribeActual.

Operator implementations (both source and intermediate) should implement this method that performs the necessary business logic and handles the incoming Observers.
public boolean
test(Object
the value
o
)

Implements io.reactivex.internal.util.AppendOnlyLinkedArrayList.NonThrowingPredicate.test.

Test the given input value and return a boolean.
Inherited from io.reactivex.subjects.Subject:
toSerialized

Field Detail

actualback to summary
pack-priv final Subject<T> actual

The actual subscriber to serialize Subscriber calls to.

doneback to summary
pack-priv volatile boolean done

Indicates a terminal event has been received and all further events will be dropped.

emittingback to summary
pack-priv boolean emitting

Indicates an emission is going on, guarded by this.

queueback to summary
pack-priv AppendOnlyLinkedArrayList<Object> queue

If not null, it holds the missed NotificationLite events.

Constructor Detail

SerializedSubjectback to summary
pack-priv SerializedSubject(final Subject<T> actual)

Constructor that wraps an actual subject.

Parameters
actual:Subject<T>

the subject wrapped

Method Detail

emitLoopback to summary
pack-priv void emitLoop()

Loops until all notifications in the queue has been processed.

getThrowableback to summary
public Throwable getThrowable()

Implements abstract io.reactivex.subjects.Subject.getThrowable.

Doc from io.reactivex.subjects.Subject.getThrowable.

Returns the error that caused the Subject to terminate or null if the Subject hasn't terminated yet.

The method is thread-safe.

Returns:Throwable

the error that caused the Subject to terminate or null if the Subject hasn't terminated yet

Annotations
@Override
@Nullable
hasCompleteback to summary
public boolean hasComplete()

Implements abstract io.reactivex.subjects.Subject.hasComplete.

Doc from io.reactivex.subjects.Subject.hasComplete.

Returns true if the subject has reached a terminal state through a complete event.

The method is thread-safe.

Returns:boolean

true if the subject has reached a terminal state through a complete event

Annotations
@Override
hasObserversback to summary
public boolean hasObservers()

Implements abstract io.reactivex.subjects.Subject.hasObservers.

Doc from io.reactivex.subjects.Subject.hasObservers.

Returns true if the subject has any Observers.

The method is thread-safe.

Returns:boolean

true if the subject has any Observers

Annotations
@Override
hasThrowableback to summary
public boolean hasThrowable()

Implements abstract io.reactivex.subjects.Subject.hasThrowable.

Doc from io.reactivex.subjects.Subject.hasThrowable.

Returns true if the subject has reached a terminal state through an error event.

The method is thread-safe.

Returns:boolean

true if the subject has reached a terminal state through an error event

Annotations
@Override
onCompleteback to summary
public void onComplete()

Implements io.reactivex.Observer.onComplete.

Doc from io.reactivex.Observer.onComplete.

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 t)

Implements io.reactivex.Observer.onError.

Doc from io.reactivex.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 onComplete.

Parameters
t:Throwable

the exception encountered by the Observable

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

Implements io.reactivex.Observer.onNext.

Doc from io.reactivex.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 onComplete or onError.

Parameters
t:T

the item emitted by the Observable

Annotations
@Override
onSubscribeback to summary
public void onSubscribe(Disposable d)

Implements io.reactivex.Observer.onSubscribe.

Doc from io.reactivex.Observer.onSubscribe.

Provides the Observer with the means of cancelling (disposing) the connection (channel) with the Observable in both synchronous (from within onNext(Object)) and asynchronous manner.

Parameters
d:Disposable

the Disposable instance whose Disposable#dispose() can be called anytime to cancel the connection

Annotations
@Override
subscribeActualback to summary
protected void subscribeActual(Observer<? super T> observer)

Implements abstract io.reactivex.Observable.subscribeActual.

Doc from io.reactivex.Observable.subscribeActual.

Operator implementations (both source and intermediate) should implement this method that performs the necessary business logic and handles the incoming Observers.

There is no need to call any of the plugin hooks on the current Observable instance or the Observer; all hooks and basic safeguards have been applied by subscribe(Observer) before this method gets called.

Parameters
observer:Observer<? super T>

the incoming Observer, never null

Annotations
@Override
testback to summary
public boolean test(Object o)

Implements io.reactivex.internal.util.AppendOnlyLinkedArrayList.NonThrowingPredicate.test.

Doc from io.reactivex.functions.Predicate.test.

Test the given input value and return a boolean.

Parameters
o:Object

the value

Returns:boolean

the boolean result

Annotations
@Override