Top Description Inners Fields Constructors Methods
io.reactivex.rxjava3.internal.operators.observable

public final Class ObservablePublish<T>

extends ConnectableObservable<T>
implements HasUpstreamObservableSource<T>
Class Inheritance
All Implemented Interfaces
io.reactivex.rxjava3.internal.fuseable.HasUpstreamObservableSource
Type Parameters
<T>
the element type
Imports
java.util.concurrent.atomic.*, io.reactivex.rxjava3.core.*, io.reactivex.rxjava3.disposables.Disposable, io.reactivex.rxjava3.exceptions.Exceptions, io.reactivex.rxjava3.functions.Consumer, io.reactivex.rxjava3.internal.disposables.DisposableHelper, io.reactivex.rxjava3.internal.fuseable.HasUpstreamObservableSource, io.reactivex.rxjava3.internal.util.ExceptionHelper, io.reactivex.rxjava3.observables.ConnectableObservable, io.reactivex.rxjava3.plugins.RxJavaPlugins

Shares a single underlying connection to the upstream ObservableSource and multicasts events to all subscribed observers until the upstream completes or the connection is disposed.

The difference to ObservablePublish is that when the upstream terminates, late observers will receive that terminal event until the connection is disposed and the ConnectableObservable is reset to its fresh state.

Since
2.2.10

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
ObservablePublish.InnerDisposable<
the element type
T
>

Intercepts the dispose signal from the downstream and removes itself from the connection's observers array at most once.

pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv final AtomicReference<ObservablePublish.PublishConnection<T>>
pack-priv final ObservableSource<T>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
connect(Consumer<? super Disposable> connection)

public void
reset()

Implements abstract io.reactivex.rxjava3.observables.ConnectableObservable.reset.

Resets this ConnectableObservable into its fresh state if it has terminated or has been disposed.
public ObservableSource<T>
source()

Implements io.reactivex.rxjava3.internal.fuseable.HasUpstreamObservableSource.source.

Returns the upstream source of this Observable.
protected void
subscribeActual(Observer<? super T> observer)

Inherited from io.reactivex.rxjava3.observables.ConnectableObservable:
autoConnectautoConnectautoConnectconnectconnectrefCountrefCountrefCountrefCountrefCountrefCount

Field Detail

currentback to summary
pack-priv final AtomicReference<ObservablePublish.PublishConnection<T>> current
sourceback to summary
pack-priv final ObservableSource<T> source

Constructor Detail

ObservablePublishback to summary
public ObservablePublish(ObservableSource<T> source)

Method Detail

connectback to summary
public void connect(Consumer<? super Disposable> connection)
Annotations
@Override
resetback to summary
public void reset()

Implements abstract io.reactivex.rxjava3.observables.ConnectableObservable.reset.

Doc from io.reactivex.rxjava3.observables.ConnectableObservable.reset.

Resets this ConnectableObservable into its fresh state if it has terminated or has been disposed.

Calling this method on a fresh or active ConnectableObservable has no effect.

Scheduler:
The behavior is determined by the implementor of this abstract class.
Annotations
@Override
sourceback to summary
public ObservableSource<T> source()

Implements io.reactivex.rxjava3.internal.fuseable.HasUpstreamObservableSource.source.

Doc from io.reactivex.rxjava3.internal.fuseable.HasUpstreamObservableSource.source.

Returns the upstream source of this Observable.

Allows discovering the chain of observables.

Returns:ObservableSource<T>

the source ObservableSource

Annotations
@Override
subscribeActualback to summary
protected void subscribeActual(Observer<? super T> observer)
Annotations
@Override
io.reactivex.rxjava3.internal.operators.observable back to summary

pack-priv final Class ObservablePublish.InnerDisposable<T>

extends AtomicReference<ObservablePublish.PublishConnection<T>>
implements Disposable
Class Inheritance
All Implemented Interfaces
io.reactivex.rxjava3.disposables.Disposable
Type Parameters
<T>
the element type

Intercepts the dispose signal from the downstream and removes itself from the connection's observers array at most once.

Field Summary

Modifier and TypeField and Description
pack-priv final Observer<? super T>
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv
InnerDisposable(Observer<? super T> downstream, ObservablePublish.PublishConnection<T> parent)

Method Summary

Modifier and TypeMethod and Description
public void
dispose()

Implements io.reactivex.rxjava3.disposables.Disposable.dispose.

Dispose the resource, the operation should be idempotent.
public boolean
isDisposed()

Implements io.reactivex.rxjava3.disposables.Disposable.isDisposed.

Returns true if this resource has been disposed.
Inherited from java.util.concurrent.atomic.AtomicReference:
accumulateAndGetcompareAndExchangecompareAndExchangeAcquirecompareAndExchangeReleasecompareAndSetgetgetAcquiregetAndAccumulategetAndSetgetAndUpdategetOpaquegetPlainlazySetsetsetOpaquesetPlainsetReleasetoStringupdateAndGetweakCompareAndSetweakCompareAndSetAcquireweakCompareAndSetPlainweakCompareAndSetReleaseweakCompareAndSetVolatile

Field Detail

downstreamback to summary
pack-priv final Observer<? super T> downstream
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.concurrent.atomic.AtomicReference.serialVersionUID.

Constructor Detail

InnerDisposableback to summary
pack-priv InnerDisposable(Observer<? super T> downstream, ObservablePublish.PublishConnection<T> parent)

Method Detail

disposeback to summary
public void dispose()

Implements io.reactivex.rxjava3.disposables.Disposable.dispose.

Doc from io.reactivex.rxjava3.disposables.Disposable.dispose.

Dispose the resource, the operation should be idempotent.

Annotations
@Override
isDisposedback to summary
public boolean isDisposed()

Implements io.reactivex.rxjava3.disposables.Disposable.isDisposed.

Doc from io.reactivex.rxjava3.disposables.Disposable.isDisposed.

Returns true if this resource has been disposed.

Returns:boolean

true if this resource has been disposed

Annotations
@Override
io.reactivex.rxjava3.internal.operators.observable back to summary

pack-priv final Class ObservablePublish.PublishConnection<T>

extends AtomicReference<ObservablePublish.InnerDisposable<T>[]>
implements Observer<T>, Disposable
Class Inheritance
All Implemented Interfaces
io.reactivex.rxjava3.disposables.Disposable, io.reactivex.rxjava3.core.Observer

Field Summary

Modifier and TypeField and Description
pack-priv final AtomicBoolean
pack-priv final AtomicReference<ObservablePublish.PublishConnection<T>>
pack-priv static final ObservablePublish.InnerDisposable<T>[]
pack-priv Throwable
private static final long
pack-priv static final ObservablePublish.InnerDisposable<T>[]
pack-priv final AtomicReference<Disposable>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
public void
dispose()

Implements io.reactivex.rxjava3.disposables.Disposable.dispose.

Dispose the resource, the operation should be idempotent.
public boolean
isDisposed()

Implements io.reactivex.rxjava3.disposables.Disposable.isDisposed.

Returns true if this resource has been disposed.
public void
onComplete()

Implements io.reactivex.rxjava3.core.Observer.onComplete.

Notifies the Observer that the Observable has finished sending push-based notifications.
public void
public void
onNext(T
the item emitted by the Observable
t
)

Implements io.reactivex.rxjava3.core.Observer.onNext.

Provides the Observer with a new item to observe.
public void
public void
Inherited from java.util.concurrent.atomic.AtomicReference:
accumulateAndGetcompareAndExchangecompareAndExchangeAcquirecompareAndExchangeReleasecompareAndSetgetgetAcquiregetAndAccumulategetAndSetgetAndUpdategetOpaquegetPlainlazySetsetsetOpaquesetPlainsetReleasetoStringupdateAndGetweakCompareAndSetweakCompareAndSetAcquireweakCompareAndSetPlainweakCompareAndSetReleaseweakCompareAndSetVolatile

Field Detail

connectback to summary
pack-priv final AtomicBoolean connect
currentback to summary
pack-priv final AtomicReference<ObservablePublish.PublishConnection<T>> current
EMPTYback to summary
pack-priv static final ObservablePublish.InnerDisposable<T>[] EMPTY
Annotations
@SuppressWarnings:rawtypes
errorback to summary
pack-priv Throwable error
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.concurrent.atomic.AtomicReference.serialVersionUID.

TERMINATEDback to summary
pack-priv static final ObservablePublish.InnerDisposable<T>[] TERMINATED
Annotations
@SuppressWarnings:rawtypes
upstreamback to summary
pack-priv final AtomicReference<Disposable> upstream

Constructor Detail

PublishConnectionback to summary
pack-priv PublishConnection(AtomicReference<ObservablePublish.PublishConnection<T>> current)
Annotations
@SuppressWarnings:unchecked

Method Detail

addback to summary
public boolean add(ObservablePublish.InnerDisposable<T> inner)
disposeback to summary
public void dispose()

Implements io.reactivex.rxjava3.disposables.Disposable.dispose.

Doc from io.reactivex.rxjava3.disposables.Disposable.dispose.

Dispose the resource, the operation should be idempotent.

Annotations
@SuppressWarnings:unchecked
@Override
isDisposedback to summary
public boolean isDisposed()

Implements io.reactivex.rxjava3.disposables.Disposable.isDisposed.

Doc from io.reactivex.rxjava3.disposables.Disposable.isDisposed.

Returns true if this resource has been disposed.

Returns:boolean

true if this resource has been disposed

Annotations
@Override
onCompleteback to summary
public void onComplete()

Implements io.reactivex.rxjava3.core.Observer.onComplete.

Doc from io.reactivex.rxjava3.core.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
@SuppressWarnings:unchecked
onErrorback to summary
public void onError(Throwable e)
Annotations
@Override
@SuppressWarnings:unchecked
onNextback to summary
public void onNext(T t)

Implements io.reactivex.rxjava3.core.Observer.onNext.

Doc from io.reactivex.rxjava3.core.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)
Annotations
@Override
removeback to summary
public void remove(ObservablePublish.InnerDisposable<T> inner)
Annotations
@SuppressWarnings:unchecked