Package rx.observables
Class SyncOnSubscribe.SyncOnSubscribeImpl<S,T>
java.lang.Object
rx.observables.SyncOnSubscribe<S,T>
rx.observables.SyncOnSubscribe.SyncOnSubscribeImpl<S,T>
- Type Parameters:
S- the type of the user-defined stateT- the type of compatible Subscribers
- All Implemented Interfaces:
Action,Action1<Subscriber<? super T>>,Function,Observable.OnSubscribe<T>
- Enclosing class:
SyncOnSubscribe<S,T>
An implementation of SyncOnSubscribe that delegates
,
invalid reference
SyncOnSubscribe#next(Object, Subscriber)
SyncOnSubscribe.generateState(),
and SyncOnSubscribe.onUnsubscribe(Object) to provided functions/closures.-
Nested Class Summary
Nested classes/interfaces inherited from class rx.observables.SyncOnSubscribe
SyncOnSubscribe.SubscriptionProducer<S,T>, SyncOnSubscribe.SyncOnSubscribeImpl<S, T> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SExecuted once when subscribed to by a subscriber (viaSyncOnSubscribe.call(Subscriber)) to produce a state value.protected SCalled to produce data to the downstream subscribers.protected voidonUnsubscribe(S state) Clean up behavior that is executed after the downstream subscriber's subscription is unsubscribed.Methods inherited from class rx.observables.SyncOnSubscribe
call, createSingleState, createSingleState, createStateful, createStateful, createStateless, createStateless
-
Field Details
-
generator
-
next
-
onUnsubscribe
-
-
Constructor Details
-
SyncOnSubscribeImpl
-
SyncOnSubscribeImpl
-
SyncOnSubscribeImpl
-
SyncOnSubscribeImpl
-
-
Method Details
-
generateState
Description copied from class:SyncOnSubscribeExecuted once when subscribed to by a subscriber (viaSyncOnSubscribe.call(Subscriber)) to produce a state value. This value is passed intonext(S state, Observeron the first iteration. Subsequent iterations ofobserver) nextwill receive the state returned by the previous invocation ofnext.- Specified by:
generateStatein classSyncOnSubscribe<S,T> - Returns:
- the initial state value
-
next
Description copied from class:SyncOnSubscribeCalled to produce data to the downstream subscribers. To emit data to a downstream subscriber callobserver.onNext(t). To signal an error condition callobserver.onError(throwable)or throw an Exception. To signal the end of a data stream callobserver.onCompleted(). Implementations of this method must follow the following rules.- Must not call
observer.onNext(t)more than 1 time per invocation. - Must not call
observer.onNext(t)concurrently.
stateargument of the next invocation of this method.- Specified by:
nextin classSyncOnSubscribe<S,T> - Parameters:
state- the state value (fromSyncOnSubscribe.generateState()on the first invocation or the previous invocation of this method.observer- the observer of data emitted by- Returns:
- the next iteration's state value
- Must not call
-
onUnsubscribe
Description copied from class:SyncOnSubscribeClean up behavior that is executed after the downstream subscriber's subscription is unsubscribed. This method will be invoked exactly once.- Overrides:
onUnsubscribein classSyncOnSubscribe<S,T> - Parameters:
state- the last state value prior fromSyncOnSubscribe.generateState()ornext(S, Observer<T>)before unsubscribe.
-