From 8f620c55abaca325672718c338885d90a4ad6ce6 Mon Sep 17 00:00:00 2001 From: Christos Gkekas Date: Thu, 22 Jul 2021 14:58:05 +0100 Subject: [PATCH] Clearly document side effects of calling Schedulers.from() Calls to Schedulers.from() APIs have the side effect of instantiating all the default RxJava Schedulers if they have not already been instantiated. This is currently not documented and should be documented to make sure that users of these APIs do not call them in latency sensitive execution paths. --- .../java/io/reactivex/rxjava3/schedulers/Schedulers.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/io/reactivex/rxjava3/schedulers/Schedulers.java b/src/main/java/io/reactivex/rxjava3/schedulers/Schedulers.java index f5dbe6ce7c..3a54d66806 100644 --- a/src/main/java/io/reactivex/rxjava3/schedulers/Schedulers.java +++ b/src/main/java/io/reactivex/rxjava3/schedulers/Schedulers.java @@ -376,6 +376,8 @@ public static Scheduler single() { * execute those tasks "unexpectedly". *

* Note that this method returns a new {@code Scheduler} instance, even for the same {@code Executor} instance. + * Calling this method will have the side effect of instantiating all the default RxJava Schedulers, + * if they have not already been instantiated. * @param executor * the executor to wrap * @return the new {@code Scheduler} wrapping the {@code Executor} @@ -450,6 +452,8 @@ public static Scheduler from(@NonNull Executor executor) { * execute those tasks "unexpectedly". *

* Note that this method returns a new {@code Scheduler} instance, even for the same {@code Executor} instance. + * Calling this method will have the side effect of instantiating all the default RxJava Schedulers, + * if they have not already been instantiated. *

History: 2.2.6 - experimental * @param executor * the executor to wrap @@ -530,6 +534,8 @@ public static Scheduler from(@NonNull Executor executor, boolean interruptibleWo * execute those tasks "unexpectedly". *

* Note that this method returns a new {@code Scheduler} instance, even for the same {@code Executor} instance. + * Calling this method will have the side effect of instantiating all the default RxJava Schedulers, + * if they have not already been instantiated. * @param executor * the executor to wrap * @param interruptibleWorker if {@code true} the tasks submitted to the {@link io.reactivex.rxjava3.core.Scheduler.Worker Scheduler.Worker} will