Class AsyncOnSubscribe.AsyncOnSubscribeImpl<S,​T>

    • Field Detail

      • generator

        private final Func0<? extends S> generator
      • onUnsubscribe

        private final Action1<? super S> onUnsubscribe
    • Constructor Detail

      • AsyncOnSubscribeImpl

        AsyncOnSubscribeImpl​(Func0<? extends S> generator,
                             Func3<? super S,​java.lang.Long,​? super Observer<Observable<? extends T>>,​? extends S> next,
                             Action1<? super S> onUnsubscribe)
      • AsyncOnSubscribeImpl

        public AsyncOnSubscribeImpl​(Func0<? extends S> generator,
                                    Func3<? super S,​java.lang.Long,​? super Observer<Observable<? extends T>>,​? extends S> next)
      • AsyncOnSubscribeImpl

        public AsyncOnSubscribeImpl​(Func3<S,​java.lang.Long,​Observer<Observable<? extends T>>,​S> nextFunc)
    • Method Detail

      • next

        protected S next​(S state,
                         long requested,
                         Observer<Observable<? extends T>> observer)
        Description copied from class: AsyncOnSubscribe
        Called to produce data to the downstream subscribers. To emit data to a downstream subscriber call observer.onNext(t). To signal an error condition call observer.onError(throwable) or throw an Exception. To signal the end of a data stream call observer.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.
        The value returned from an invocation of this method will be passed in as the state argument of the next invocation of this method.
        Specified by:
        next in class AsyncOnSubscribe<S,​T>
        Parameters:
        state - the state value (from AsyncOnSubscribe.generateState() on the first invocation or the previous invocation of this method.
        requested - the amount of data requested. An observable emitted to the observer should not exceed this amount.
        observer - the observer of data emitted by
        Returns:
        the next iteration's state value
      • onUnsubscribe

        protected void onUnsubscribe​(S state)
        Description copied from class: AsyncOnSubscribe
        Clean up behavior that is executed after the downstream subscriber's subscription is unsubscribed. This method will be invoked exactly once.
        Overrides:
        onUnsubscribe in class AsyncOnSubscribe<S,​T>
        Parameters:
        state - the last state value returned from next(S, Long, Observer) or generateState() at the time when a terminal event is emitted from AsyncOnSubscribe.next(Object, long, Observer) or unsubscribing.