generateState(S) ,
next(S, Subscriber), and
onUnsubscribe(S).
Subscribers that will be compatible with this.
OnSubscribe<T> functions that responds correctly to back
pressure requests from subscribers. This is an improvement over
Observable.create(OnSubscribe) which does not provide
any means of managing back pressure requests out-of-the-box.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | SyncOnSubscribe.SubscriptionProducer<S,
the type of compatible Subscribers T>Contains the producer loop that reacts to downstream requests of work. |
| pack-priv static class | SyncOnSubscribe.SyncOnSubscribeImpl<
the type of the user-defined state S, the type of compatible Subscribers T>An implementation of SyncOnSubscribe that delegates
|
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final void | |
| public static < the type of the associated state with each Subscriber S, the type of the generated values T> SyncOnSubscribe | Returns: a SyncOnSubscribe that emits data in a protocol compatible with back-pressure.generates the initial state value (see generator, final Action2<? super S, ? super Observer<? super T>> generateState())produces data to the downstream subscriber (see next)next(S, Subscriber))Generates a synchronous |
| public static < the type of the associated state with each Subscriber S, the type of the generated values T> SyncOnSubscribe | Returns: a SyncOnSubscribe that emits data downstream in a protocol compatible with back-pressure.generates the initial state value (see generator, final Action2<? super S, ? super Observer<? super T>> generateState())produces data to the downstream subscriber (see next, final Action1<? super S> next(S, Subscriber))clean up behavior (see onUnsubscribe)onUnsubscribe(S))Generates a synchronous |
| public static < the type of the associated state with each Subscriber S, the type of the generated values T> SyncOnSubscribe | Returns: a SyncOnSubscribe that emits data downstream in a protocol compatible with back-pressure.generates the initial state value (see generator, Func2<? super S, ? super Observer<? super T>, ? extends S> generateState())produces data to the downstream subscriber (see next, Action1<? super S> next(S, Subscriber))clean up behavior (see onUnsubscribe)onUnsubscribe(S))Generates a synchronous |
| public static < the type of the associated state with each Subscriber S, the type of the generated values T> SyncOnSubscribe | Returns: a SyncOnSubscribe that emits data downstream in a protocol compatible with back-pressure.generates the initial state value (see generator, Func2<? super S, ? super Observer<? super T>, ? extends S> generateState())produces data to the downstream subscriber (see next)next(S, Subscriber))Generates a synchronous |
| public static < the type of the generated values T> SyncOnSubscribe | Returns: a SyncOnSubscribe that emits data downstream in a protocol compatible with back-pressure.produces data to the downstream subscriber (see next)next(S, Subscriber))Generates a synchronous |
| public static < the type of the generated values T> SyncOnSubscribe | Returns: a SyncOnSubscribe that emits data downstream in a protocol compatible with back-pressure.produces data to the downstream subscriber (see next, final Action0 next(S, Subscriber))clean up behavior (see onUnsubscribe)onUnsubscribe(S))Generates a synchronous |
| protected abstract S | Returns: the initial state valueExecuted once when subscribed to by a subscriber (via |
| protected abstract S | Returns: the next iteration's state valuethe state value (from state, Observer<? super T> generateState() on the first invocation or the
previous invocation of this method.the observer of data emitted by observer)Called to produce data to the downstream subscribers. |
| protected void | onUnsubscribe(S
the last state value prior from state)generateState() or
next(S, Observer<T>) before unsubscribe.Clean up behavior that is executed after the downstream subscriber's subscription is unsubscribed. |
| SyncOnSubscribe | back to summary |
|---|---|
| public SyncOnSubscribe() | |
| call | back to summary |
|---|---|
| public final void call(final Subscriber<? super T> subscriber) Implements rx.
| |
| createSingleState | back to summary |
|---|---|
| public static <S, T> SyncOnSubscribe Generates a synchronous
| |
| createSingleState | back to summary |
|---|---|
| public static <S, T> SyncOnSubscribe Generates a synchronous
| |
| createStateful | back to summary |
|---|---|
| public static <S, T> SyncOnSubscribe Generates a synchronous
| |
| createStateful | back to summary |
|---|---|
| public static <S, T> SyncOnSubscribe Generates a synchronous
| |
| createStateless | back to summary |
|---|---|
| public static <T> SyncOnSubscribe Generates a synchronous
| |
| createStateless | back to summary |
|---|---|
| public static <T> SyncOnSubscribe Generates a synchronous
| |
| generateState | back to summary |
|---|---|
| protected abstract S generateState() Executed once when subscribed to by a subscriber (via
| |
| next | back to summary |
|---|---|
| protected abstract S next(S state, Observer<? super T> observer) Called to produce data to the downstream subscribers. To emit data to a downstream subscriber
call
state
argument of the next invocation of this method.
| |
| onUnsubscribe | back to summary |
|---|---|
| protected void onUnsubscribe(S state) Clean up behavior that is executed after the downstream subscriber's subscription is unsubscribed. This method will be invoked exactly once.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final Subscriber | |
| private boolean | |
| private boolean | |
| private final SyncOnSubscribe | |
| private static final long | |
| private S |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | |
| private void | |
| public boolean | isUnsubscribed()
Implements rx. Subscription is currently unsubscribed.
|
| private void | |
| public void | onCompleted()
Implements rx. Observable has finished sending push-based notifications.
|
| public void | onError(Throwable
the exception encountered by the Observable e)Implements rx. Observable has experienced an error condition.
|
| public void | onNext(T
the item emitted by the Observable value)Implements rx. |
| public void | request(long
the maximum number of items you want this Producer to produce, or n)Long.MAX_VALUE if you
want the Producer to produce items at its own paceImplements rx. |
| private void | |
| private boolean | |
| public void | unsubscribe()
Implements rx. Subscriber that was registered when this Subscription
was received.
|
| actualSubscriber | back to summary |
|---|---|
| private final Subscriber<? super T> actualSubscriber | |
| hasTerminated | back to summary |
|---|---|
| private boolean hasTerminated | |
| onNextCalled | back to summary |
|---|---|
| private boolean onNextCalled | |
| parent | back to summary |
|---|---|
| private final SyncOnSubscribe<S, T> parent | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides java. | |
| state | back to summary |
|---|---|
| private S state | |
| SubscriptionProducer | back to summary |
|---|---|
| pack-priv SubscriptionProducer(final Subscriber<? super T> subscriber, SyncOnSubscribe<S, T> parent, S state) | |
| doUnsubscribe | back to summary |
|---|---|
| private void doUnsubscribe() | |
| fastPath | back to summary |
|---|---|
| private void fastPath() | |
| handleThrownError | back to summary |
|---|---|
| private void handleThrownError(Subscriber<? super T> a, Throwable ex) | |
| isUnsubscribed | back to summary |
|---|---|
| public boolean isUnsubscribed() Implements rx. Doc from rx. Indicates whether this
| |
| nextIteration | back to summary |
|---|---|
| private void nextIteration(final SyncOnSubscribe<S, T> parent) | |
| onCompleted | back to summary |
|---|---|
| public void onCompleted() Implements rx. Doc from rx. Notifies the Observer that the
The
| |
| onError | back to summary |
|---|---|
| public void onError(Throwable e) Implements rx. Doc from rx. Notifies the Observer that the
If the | |
| onNext | back to summary |
|---|---|
| public void onNext(T value) Implements rx. Doc from rx. Provides the Observer with a new item to observe.
The
The
| |
| request | back to summary |
|---|---|
| public void request(long n) Implements rx. Doc from rx. Request a certain maximum number of items from this Producer. This is a way of requesting backpressure.
To disable backpressure, pass
Requests are additive but if a sequence of requests totals more than request(100); request(Long.MAX_VALUE-1);
| |
| slowPath | back to summary |
|---|---|
| private void slowPath(long n) | |
| tryUnsubscribe | back to summary |
|---|---|
| private boolean tryUnsubscribe() | |
| unsubscribe | back to summary |
|---|---|
| public void unsubscribe() Implements rx. Doc from rx. Stops the receipt of notifications on the
This allows deregistering an
| |
SyncOnSubscribe#next(Object, Observer), SyncOnSubscribe#generateState(),
and SyncOnSubscribe#onUnsubscribe(Object) to provided functions/closures.
| Modifier and Type | Field and Description |
|---|---|
| private final Func0 | |
| private final Func2 | |
| private final Action1 |
| Access | Constructor and Description |
|---|---|
| pack-priv | SyncOnSubscribeImpl(Func0<? extends S> generator, Func2<? super S, ? super Observer<? super T>, ? extends S> next, Action1<? super S> onUnsubscribe)
|
| public | SyncOnSubscribeImpl(Func0<? extends S> generator, Func2<? super S, ? super Observer<? super T>, ? extends S> next)
|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected S | generateState()
Implements abstract rx. call(Subscriber))
to produce a state value.
|
| protected S | next(S
the state value (from state, Observer<? super T> generateState() on the first invocation or the
previous invocation of this method.the observer of data emitted by observer)Implements abstract rx. |
| protected void | onUnsubscribe(S
the last state value prior from state)generateState() or
next(S, Observer<T>) before unsubscribe.Overrides rx. |
| generator | back to summary |
|---|---|
| private final Func0<? extends S> generator | |
| next | back to summary |
|---|---|
| private final Func2<? super S, ? super Observer<? super T>, ? extends S> next | |
| onUnsubscribe | back to summary |
|---|---|
| private final Action1<? super S> onUnsubscribe | |
| SyncOnSubscribeImpl | back to summary |
|---|---|
| pack-priv SyncOnSubscribeImpl(Func0<? extends S> generator, Func2<? super S, ? super Observer<? super T>, ? extends S> next, Action1<? super S> onUnsubscribe) | |
| SyncOnSubscribeImpl | back to summary |
|---|---|
| public SyncOnSubscribeImpl(Func0<? extends S> generator, Func2<? super S, ? super Observer<? super T>, ? extends S> next) | |
| SyncOnSubscribeImpl | back to summary |
|---|---|
| public SyncOnSubscribeImpl(Func2<S, Observer<? super T>, S> next, Action1<? super S> onUnsubscribe) | |
| SyncOnSubscribeImpl | back to summary |
|---|---|
| public SyncOnSubscribeImpl(Func2<S, Observer<? super T>, S> nextFunc) | |
| generateState | back to summary |
|---|---|
| protected S generateState() Implements abstract rx. Doc from rx. Executed once when subscribed to by a subscriber (via
| |
| next | back to summary |
|---|---|
| protected S next(S state, Observer<? super T> observer) Implements abstract rx. Doc from rx. Called to produce data to the downstream subscribers. To emit data to a downstream subscriber
call
state
argument of the next invocation of this method.
| |
| onUnsubscribe | back to summary |
|---|---|
| protected void onUnsubscribe(S state) Overrides rx. Doc from rx. Clean up behavior that is executed after the downstream subscriber's subscription is unsubscribed. This method will be invoked exactly once.
| |