T - the type of values observed from the sourceU - the type of values emmitted to registered observerspublic class DefaultConnectableObservable<T,U> extends java.lang.Object implements ConnectableObservable<U>
| Modifier and Type | Class and Description |
|---|---|
protected class |
DefaultConnectableObservable.InnerConnection
The inner connection that nulls out the
parent class' connection and deregisters the subject, but only once.
|
| Modifier and Type | Field and Description |
|---|---|
protected java.io.Closeable |
connection
The active connection's close reference.
|
protected java.util.concurrent.locks.Lock |
lock
The lock.
|
protected Observable<? extends T> |
source
The source observable.
|
protected Subject<? super T,? extends U> |
subject
The subject that is connected to the source.
|
| Constructor and Description |
|---|
DefaultConnectableObservable(Observable<? extends T> source,
Subject<? super T,? extends U> subject)
Creates an observable which can be connected and disconnected from the source.
|
DefaultConnectableObservable(Observable<? extends T> source,
Subject<? super T,? extends U> subject,
java.util.concurrent.locks.Lock lock)
Creates an observable which can be connected and disconnected from the source.
|
| Modifier and Type | Method and Description |
|---|---|
java.io.Closeable |
connect()
Connects the wrapper to its source.
|
java.io.Closeable |
register(Observer<? super U> observer)
Registers an observer for the notification of Ts.
|
@Nonnull protected final Subject<? super T,? extends U> subject
@Nonnull protected final Observable<? extends T> source
@Nonnull protected final java.util.concurrent.locks.Lock lock
@Nullable protected java.io.Closeable connection
public DefaultConnectableObservable(@Nonnull
Observable<? extends T> source,
@Nonnull
Subject<? super T,? extends U> subject)
Uses fair ReentrantLock.
source - the underlying observable source of Tssubject - the observer that receives values from the source in case it is connectedpublic DefaultConnectableObservable(@Nonnull
Observable<? extends T> source,
@Nonnull
Subject<? super T,? extends U> subject,
@Nonnull
java.util.concurrent.locks.Lock lock)
source - the underlying observable source of Tssubject - the observer that receives values from the source in case it is connectedlock - the lock to usepublic java.io.Closeable connect()
ConnectableObservableconnect in interface ConnectableObservable<U>@Nonnull
public java.io.Closeable register(@Nonnull
Observer<? super U> observer)
Observableregister in interface Observable<U>observer - the observer of Ts or any supertype of it