Package rx.internal.operators
Class OperatorReplay<T>
- java.lang.Object
-
- rx.Observable<T>
-
- rx.observables.ConnectableObservable<T>
-
- rx.internal.operators.OperatorReplay<T>
-
public final class OperatorReplay<T> extends ConnectableObservable<T>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
OperatorReplay.BoundedReplayBuffer<T>
Base class for bounded buffering with options to specify an enter and leave transforms and custom truncation behavior.(package private) static class
OperatorReplay.InnerProducer<T>
A Producer and Subscription that manages the request and unsubscription state of a child subscriber in thread-safe manner.(package private) static class
OperatorReplay.Node
Represents a node in a bounded replay buffer's linked list.(package private) static interface
OperatorReplay.ReplayBuffer<T>
The interface for interacting with various buffering logic.(package private) static class
OperatorReplay.ReplaySubscriber<T>
(package private) static class
OperatorReplay.SizeAndTimeBoundReplayBuffer<T>
Size and time bound replay buffer.(package private) static class
OperatorReplay.SizeBoundReplayBuffer<T>
A bounded replay buffer implementation with size limit only.(package private) static class
OperatorReplay.UnboundedReplayBuffer<T>
Holds an unbounded list of events.-
Nested classes/interfaces inherited from class rx.Observable
Observable.OnSubscribe<T>, Observable.Operator<R,T>, Observable.Transformer<T,R>
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Func0<? extends OperatorReplay.ReplayBuffer<T>>
bufferFactory
A factory that creates the appropriate buffer for the ReplaySubscriber.(package private) java.util.concurrent.atomic.AtomicReference<OperatorReplay.ReplaySubscriber<T>>
current
Holds the current subscriber that is, will be or just was subscribed to the source observable.(package private) static Func0
DEFAULT_UNBOUNDED_FACTORY
(package private) Observable<? extends T>
source
The source observable.
-
Constructor Summary
Constructors Modifier Constructor Description private
OperatorReplay(Observable.OnSubscribe<T> onSubscribe, Observable<? extends T> source, java.util.concurrent.atomic.AtomicReference<OperatorReplay.ReplaySubscriber<T>> current, Func0<? extends OperatorReplay.ReplayBuffer<T>> bufferFactory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
connect(Action1<? super Subscription> connection)
Instructs theConnectableObservable
to begin emitting the items from its underlyingObservable
to itsSubscriber
s.static <T> ConnectableObservable<T>
create(Observable<? extends T> source)
Creates a replaying ConnectableObservable with an unbounded buffer.static <T> ConnectableObservable<T>
create(Observable<? extends T> source, int bufferSize)
Creates a replaying ConnectableObservable with a size bound buffer.static <T> ConnectableObservable<T>
create(Observable<? extends T> source, long maxAge, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
Creates a replaying ConnectableObservable with a time bound buffer.static <T> ConnectableObservable<T>
create(Observable<? extends T> source, long maxAge, java.util.concurrent.TimeUnit unit, Scheduler scheduler, int bufferSize)
Creates a replaying ConnectableObservable with a size and time bound buffer.(package private) static <T> ConnectableObservable<T>
create(Observable<? extends T> source, Func0<? extends OperatorReplay.ReplayBuffer<T>> bufferFactory)
Creates a OperatorReplay instance to replay values of the given source observable.static <T,U,R>
Observable<R>multicastSelector(Func0<? extends ConnectableObservable<U>> connectableFactory, Func1<? super Observable<U>,? extends Observable<R>> selector)
Given a connectable observable factory, it multicasts over the generated ConnectableObservable via a selector function.static <T> ConnectableObservable<T>
observeOn(ConnectableObservable<T> co, Scheduler scheduler)
Child Subscribers will observe the events of the ConnectableObservable on the specified scheduler.-
Methods inherited from class rx.observables.ConnectableObservable
autoConnect, autoConnect, autoConnect, connect, refCount
-
Methods inherited from class rx.Observable
all, amb, amb, amb, amb, amb, amb, amb, amb, amb, ambWith, asObservable, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, cache, cache, cacheWithInitialCapacity, cast, collect, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatestDelayError, compose, concat, concat, concat, concat, concat, concat, concat, concat, concat, concatDelayError, concatDelayError, concatEager, concatEager, concatEager, concatEager, concatEager, concatEager, concatEager, concatEager, concatEager, concatEager, concatEager, concatEager, concatMap, concatMapDelayError, concatMapEager, concatMapEager, concatMapEager, concatMapIterable, concatWith, contains, count, countLong, create, create, create, debounce, debounce, debounce, defaultIfEmpty, defer, delay, delay, delay, delay, delaySubscription, delaySubscription, delaySubscription, delaySubscription, dematerialize, distinct, distinct, distinctUntilChanged, distinctUntilChanged, distinctUntilChanged, doAfterTerminate, doOnCompleted, doOnEach, doOnEach, doOnError, doOnNext, doOnRequest, doOnSubscribe, doOnTerminate, doOnUnsubscribe, elementAt, elementAtOrDefault, empty, error, exists, extend, filter, finallyDo, first, first, firstOrDefault, firstOrDefault, flatMap, flatMap, flatMap, flatMap, flatMap, flatMap, flatMapIterable, flatMapIterable, flatMapIterable, flatMapIterable, forEach, forEach, forEach, from, from, from, from, from, fromAsync, fromCallable, groupBy, groupBy, groupBy, groupJoin, ignoreElements, interval, interval, interval, interval, isEmpty, join, just, just, just, just, just, just, just, just, just, just, last, last, lastOrDefault, lastOrDefault, lift, limit, map, materialize, merge, merge, merge, merge, merge, merge, merge, merge, merge, merge, merge, merge, merge, merge, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeWith, nest, never, observeOn, observeOn, observeOn, observeOn, ofType, onBackpressureBuffer, onBackpressureBuffer, onBackpressureBuffer, onBackpressureBuffer, onBackpressureDrop, onBackpressureDrop, onBackpressureLatest, onErrorResumeNext, onErrorResumeNext, onErrorReturn, onExceptionResumeNext, onTerminateDetach, publish, publish, range, range, rebatchRequests, reduce, reduce, repeat, repeat, repeat, repeat, repeatWhen, repeatWhen, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, retry, retry, retry, retryWhen, retryWhen, sample, sample, sample, scan, scan, sequenceEqual, sequenceEqual, serialize, share, single, single, singleOrDefault, singleOrDefault, skip, skip, skip, skipLast, skipLast, skipLast, skipUntil, skipWhile, startWith, startWith, startWith, startWith, startWith, startWith, startWith, startWith, startWith, startWith, startWith, subscribe, subscribe, subscribe, subscribe, subscribe, subscribe, subscribeOn, switchIfEmpty, switchMap, switchMapDelayError, switchOnNext, switchOnNextDelayError, take, take, take, takeFirst, takeLast, takeLast, takeLast, takeLast, takeLast, takeLastBuffer, takeLastBuffer, takeLastBuffer, takeLastBuffer, takeLastBuffer, takeUntil, takeUntil, takeWhile, throttleFirst, throttleFirst, throttleLast, throttleLast, throttleWithTimeout, throttleWithTimeout, timeInterval, timeInterval, timeout, timeout, timeout, timeout, timeout, timeout, timeout, timeout, timer, timer, timer, timer, timestamp, timestamp, toBlocking, toCompletable, toList, toMap, toMap, toMap, toMultimap, toMultimap, toMultimap, toMultimap, toSingle, toSortedList, toSortedList, toSortedList, toSortedList, unsafeSubscribe, unsubscribeOn, using, using, window, window, window, window, window, window, window, window, window, window, window, window, withLatestFrom, withLatestFrom, withLatestFrom, withLatestFrom, withLatestFrom, withLatestFrom, withLatestFrom, withLatestFrom, withLatestFrom, withLatestFrom, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zipWith, zipWith
-
-
-
-
Field Detail
-
source
final Observable<? extends T> source
The source observable.
-
current
final java.util.concurrent.atomic.AtomicReference<OperatorReplay.ReplaySubscriber<T>> current
Holds the current subscriber that is, will be or just was subscribed to the source observable.
-
bufferFactory
final Func0<? extends OperatorReplay.ReplayBuffer<T>> bufferFactory
A factory that creates the appropriate buffer for the ReplaySubscriber.
-
DEFAULT_UNBOUNDED_FACTORY
static final Func0 DEFAULT_UNBOUNDED_FACTORY
-
-
Constructor Detail
-
OperatorReplay
private OperatorReplay(Observable.OnSubscribe<T> onSubscribe, Observable<? extends T> source, java.util.concurrent.atomic.AtomicReference<OperatorReplay.ReplaySubscriber<T>> current, Func0<? extends OperatorReplay.ReplayBuffer<T>> bufferFactory)
-
-
Method Detail
-
multicastSelector
public static <T,U,R> Observable<R> multicastSelector(Func0<? extends ConnectableObservable<U>> connectableFactory, Func1<? super Observable<U>,? extends Observable<R>> selector)
Given a connectable observable factory, it multicasts over the generated ConnectableObservable via a selector function.- Type Parameters:
T
- the upstream's value typeU
- the intermediate value type of the ConnectableObservableR
- the final value type provided by the selector function- Parameters:
connectableFactory
- the factory that returns a ConnectableObservable instanceselector
- the function applied on the ConnectableObservable and returns the Observable the downstream will subscribe to.- Returns:
- the Observable multicasting over a transformation of a ConnectableObserable
-
observeOn
public static <T> ConnectableObservable<T> observeOn(ConnectableObservable<T> co, Scheduler scheduler)
Child Subscribers will observe the events of the ConnectableObservable on the specified scheduler.- Type Parameters:
T
- the value type- Parameters:
co
- the ConnectableObservable to schedule on the specified schedulerscheduler
- the target Scheduler instance- Returns:
- the ConnectableObservable instance that is observed on the specified scheduler
-
create
public static <T> ConnectableObservable<T> create(Observable<? extends T> source)
Creates a replaying ConnectableObservable with an unbounded buffer.- Type Parameters:
T
- the value type- Parameters:
source
- the source Observable- Returns:
- the replaying ConnectableObservable
-
create
public static <T> ConnectableObservable<T> create(Observable<? extends T> source, int bufferSize)
Creates a replaying ConnectableObservable with a size bound buffer.- Type Parameters:
T
- the value type- Parameters:
source
- the source ObservablebufferSize
- the maximum number of elements buffered- Returns:
- the replaying ConnectableObservable
-
create
public static <T> ConnectableObservable<T> create(Observable<? extends T> source, long maxAge, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
Creates a replaying ConnectableObservable with a time bound buffer.- Type Parameters:
T
- the value type- Parameters:
source
- the source ObservablemaxAge
- the maximum age (exclusive) of each item when timestamped with the given schedulerunit
- the time unit of the maximum agescheduler
- the scheduler providing the notion of current time- Returns:
- the replaying ConnectableObservable
-
create
public static <T> ConnectableObservable<T> create(Observable<? extends T> source, long maxAge, java.util.concurrent.TimeUnit unit, Scheduler scheduler, int bufferSize)
Creates a replaying ConnectableObservable with a size and time bound buffer.- Type Parameters:
T
- the value type- Parameters:
source
- the source ObservablemaxAge
- the maximum age (exclusive) of each item when timestamped with the given schedulerunit
- the time unit of the maximum agescheduler
- the scheduler providing the notion of current timebufferSize
- the maximum number of elements buffered- Returns:
- the replaying ConnectableObservable
-
create
static <T> ConnectableObservable<T> create(Observable<? extends T> source, Func0<? extends OperatorReplay.ReplayBuffer<T>> bufferFactory)
Creates a OperatorReplay instance to replay values of the given source observable.- Parameters:
source
- the source observablebufferFactory
- the factory to instantiate the appropriate buffer when the observable becomes active- Returns:
- the connectable observable
-
connect
public void connect(Action1<? super Subscription> connection)
Description copied from class:ConnectableObservable
Instructs theConnectableObservable
to begin emitting the items from its underlyingObservable
to itsSubscriber
s.- Specified by:
connect
in classConnectableObservable<T>
- Parameters:
connection
- the action that receives the connection subscription before the subscription to source happens allowing the caller to synchronously disconnect a synchronous source- See Also:
- ReactiveX documentation: Connect
-
-