Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javadoc : Explain explicitly about using Emitter interface methods synchronously #6305

Merged
merged 1 commit into from
Nov 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/java/io/reactivex/Emitter.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
/**
* Base interface for emitting signals in a push-fashion in various generator-like source
* operators (create, generate).
* <p>
* Note that the {@link Emitter#onNext}, {@link Emitter#onError} and
* {@link Emitter#onComplete} methods provided to the function via the {@link Emitter} instance should be called synchronously,
* never concurrently. Calling them from multiple threads is not supported and leads to an
* undefined behavior.
*
* @param <T> the value type emitted
*/
Expand Down
25 changes: 25 additions & 0 deletions src/main/java/io/reactivex/Flowable.java
Original file line number Diff line number Diff line change
Expand Up @@ -2210,6 +2210,11 @@ public static <T> Flowable<T> fromPublisher(final Publisher<? extends T> source)

/**
* Returns a cold, synchronous, stateless and backpressure-aware generator of values.
* <p>
* Note that the {@link Emitter#onNext}, {@link Emitter#onError} and
* {@link Emitter#onComplete} methods provided to the function via the {@link Emitter} instance should be called synchronously,
* never concurrently and only while the function body is executing. Calling them from multiple threads
* or outside the function call is not supported and leads to an undefined behavior.
* <dl>
* <dt><b>Backpressure:</b></dt>
* <dd>The operator honors downstream backpressure.</dd>
Expand All @@ -2236,6 +2241,11 @@ public static <T> Flowable<T> generate(final Consumer<Emitter<T>> generator) {

/**
* Returns a cold, synchronous, stateful and backpressure-aware generator of values.
* <p>
* Note that the {@link Emitter#onNext}, {@link Emitter#onError} and
* {@link Emitter#onComplete} methods provided to the function via the {@link Emitter} instance should be called synchronously,
* never concurrently and only while the function body is executing. Calling them from multiple threads
* or outside the function call is not supported and leads to an undefined behavior.
* <dl>
* <dt><b>Backpressure:</b></dt>
* <dd>The operator honors downstream backpressure.</dd>
Expand Down Expand Up @@ -2263,6 +2273,11 @@ public static <T, S> Flowable<T> generate(Callable<S> initialState, final BiCons

/**
* Returns a cold, synchronous, stateful and backpressure-aware generator of values.
* <p>
* Note that the {@link Emitter#onNext}, {@link Emitter#onError} and
* {@link Emitter#onComplete} methods provided to the function via the {@link Emitter} instance should be called synchronously,
* never concurrently and only while the function body is executing. Calling them from multiple threads
* or outside the function call is not supported and leads to an undefined behavior.
* <dl>
* <dt><b>Backpressure:</b></dt>
* <dd>The operator honors downstream backpressure.</dd>
Expand Down Expand Up @@ -2292,6 +2307,11 @@ public static <T, S> Flowable<T> generate(Callable<S> initialState, final BiCons

/**
* Returns a cold, synchronous, stateful and backpressure-aware generator of values.
* <p>
* Note that the {@link Emitter#onNext}, {@link Emitter#onError} and
* {@link Emitter#onComplete} methods provided to the function via the {@link Emitter} instance should be called synchronously,
* never concurrently and only while the function body is executing. Calling them from multiple threads
* or outside the function call is not supported and leads to an undefined behavior.
* <dl>
* <dt><b>Backpressure:</b></dt>
* <dd>The operator honors downstream backpressure.</dd>
Expand All @@ -2318,6 +2338,11 @@ public static <T, S> Flowable<T> generate(Callable<S> initialState, BiFunction<S

/**
* Returns a cold, synchronous, stateful and backpressure-aware generator of values.
* <p>
* Note that the {@link Emitter#onNext}, {@link Emitter#onError} and
* {@link Emitter#onComplete} methods provided to the function via the {@link Emitter} instance should be called synchronously,
* never concurrently and only while the function body is executing. Calling them from multiple threads
* or outside the function call is not supported and leads to an undefined behavior.
* <dl>
* <dt><b>Backpressure:</b></dt>
* <dd>The operator honors downstream backpressure.</dd>
Expand Down
25 changes: 25 additions & 0 deletions src/main/java/io/reactivex/Observable.java
Original file line number Diff line number Diff line change
Expand Up @@ -1992,6 +1992,11 @@ public static <T> Observable<T> fromPublisher(Publisher<? extends T> publisher)
* Returns a cold, synchronous and stateless generator of values.
* <p>
* <img width="640" height="315" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/generate.2.png" alt="">
* <p>
* Note that the {@link Emitter#onNext}, {@link Emitter#onError} and
* {@link Emitter#onComplete} methods provided to the function via the {@link Emitter} instance should be called synchronously,
* never concurrently and only while the function body is executing. Calling them from multiple threads
* or outside the function call is not supported and leads to an undefined behavior.
* <dl>
* <dt><b>Scheduler:</b></dt>
* <dd>{@code generate} does not operate by default on a particular {@link Scheduler}.</dd>
Expand All @@ -2016,6 +2021,11 @@ public static <T> Observable<T> generate(final Consumer<Emitter<T>> generator) {
* Returns a cold, synchronous and stateful generator of values.
* <p>
* <img width="640" height="315" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/generate.2.png" alt="">
* <p>
* Note that the {@link Emitter#onNext}, {@link Emitter#onError} and
* {@link Emitter#onComplete} methods provided to the function via the {@link Emitter} instance should be called synchronously,
* never concurrently and only while the function body is executing. Calling them from multiple threads
* or outside the function call is not supported and leads to an undefined behavior.
* <dl>
* <dt><b>Scheduler:</b></dt>
* <dd>{@code generate} does not operate by default on a particular {@link Scheduler}.</dd>
Expand All @@ -2041,6 +2051,11 @@ public static <T, S> Observable<T> generate(Callable<S> initialState, final BiCo
* Returns a cold, synchronous and stateful generator of values.
* <p>
* <img width="640" height="315" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/generate.2.png" alt="">
* <p>
* Note that the {@link Emitter#onNext}, {@link Emitter#onError} and
* {@link Emitter#onComplete} methods provided to the function via the {@link Emitter} instance should be called synchronously,
* never concurrently and only while the function body is executing. Calling them from multiple threads
* or outside the function call is not supported and leads to an undefined behavior.
* <dl>
* <dt><b>Scheduler:</b></dt>
* <dd>{@code generate} does not operate by default on a particular {@link Scheduler}.</dd>
Expand Down Expand Up @@ -2071,6 +2086,11 @@ public static <T, S> Observable<T> generate(
* Returns a cold, synchronous and stateful generator of values.
* <p>
* <img width="640" height="315" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/generate.2.png" alt="">
* <p>
* Note that the {@link Emitter#onNext}, {@link Emitter#onError} and
* {@link Emitter#onComplete} methods provided to the function via the {@link Emitter} instance should be called synchronously,
* never concurrently and only while the function body is executing. Calling them from multiple threads
* or outside the function call is not supported and leads to an undefined behavior.
* <dl>
* <dt><b>Scheduler:</b></dt>
* <dd>{@code generate} does not operate by default on a particular {@link Scheduler}.</dd>
Expand All @@ -2096,6 +2116,11 @@ public static <T, S> Observable<T> generate(Callable<S> initialState, BiFunction
* Returns a cold, synchronous and stateful generator of values.
* <p>
* <img width="640" height="315" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/generate.2.png" alt="">
* <p>
* Note that the {@link Emitter#onNext}, {@link Emitter#onError} and
* {@link Emitter#onComplete} methods provided to the function via the {@link Emitter} instance should be called synchronously,
* never concurrently and only while the function body is executing. Calling them from multiple threads
* or outside the function call is not supported and leads to an undefined behavior.
* <dl>
* <dt><b>Scheduler:</b></dt>
* <dd>{@code generate} does not operate by default on a particular {@link Scheduler}.</dd>
Expand Down