@@ -340,6 +340,16 @@ public static Scheduler single() {
340
340
* }
341
341
* </code></pre>
342
342
* <p>
343
+ * Note that the provided {@code Executor} should avoid throwing a {@link RejectedExecutionException}
344
+ * (for example, by shutting it down prematurely or using a bounded-queue {@code ExecutorService})
345
+ * because such circumstances prevent RxJava from progressing flow-related activities correctly.
346
+ * If the {@link Executor#execute(Runnable)} or {@link ExecutorService#submit(Callable)} throws,
347
+ * the {@code RejectedExecutionException} is routed to the global error handler via
348
+ * {@link RxJavaPlugins#onError(Throwable)}. To avoid shutdown-reladed problems, it is recommended
349
+ * all flows using the returned {@code Scheduler} to be canceled/disposed before the underlying
350
+ * {@code Executor} is shut down. To avoid problems due to the {@code Executor} having a bounded-queue,
351
+ * it is recommended to rephrase the flow to utilize backpressure as the means to limit outstanding work.
352
+ * <p>
343
353
* This type of scheduler is less sensitive to leaking {@link io.reactivex.rxjava3.core.Scheduler.Worker Scheduler.Worker} instances, although
344
354
* not disposing a worker that has timed/delayed tasks not cancelled by other means may leak resources and/or
345
355
* execute those tasks "unexpectedly".
@@ -404,6 +414,16 @@ public static Scheduler from(@NonNull Executor executor) {
404
414
* }
405
415
* </code></pre>
406
416
* <p>
417
+ * Note that the provided {@code Executor} should avoid throwing a {@link RejectedExecutionException}
418
+ * (for example, by shutting it down prematurely or using a bounded-queue {@code ExecutorService})
419
+ * because such circumstances prevent RxJava from progressing flow-related activities correctly.
420
+ * If the {@link Executor#execute(Runnable)} or {@link ExecutorService#submit(Callable)} throws,
421
+ * the {@code RejectedExecutionException} is routed to the global error handler via
422
+ * {@link RxJavaPlugins#onError(Throwable)}. To avoid shutdown-reladed problems, it is recommended
423
+ * all flows using the returned {@code Scheduler} to be canceled/disposed before the underlying
424
+ * {@code Executor} is shut down. To avoid problems due to the {@code Executor} having a bounded-queue,
425
+ * it is recommended to rephrase the flow to utilize backpressure as the means to limit outstanding work.
426
+ * <p>
407
427
* This type of scheduler is less sensitive to leaking {@link io.reactivex.rxjava3.core.Scheduler.Worker Scheduler.Worker} instances, although
408
428
* not disposing a worker that has timed/delayed tasks not cancelled by other means may leak resources and/or
409
429
* execute those tasks "unexpectedly".
@@ -474,6 +494,16 @@ public static Scheduler from(@NonNull Executor executor, boolean interruptibleWo
474
494
* }
475
495
* </code></pre>
476
496
* <p>
497
+ * Note that the provided {@code Executor} should avoid throwing a {@link RejectedExecutionException}
498
+ * (for example, by shutting it down prematurely or using a bounded-queue {@code ExecutorService})
499
+ * because such circumstances prevent RxJava from progressing flow-related activities correctly.
500
+ * If the {@link Executor#execute(Runnable)} or {@link ExecutorService#submit(Callable)} throws,
501
+ * the {@code RejectedExecutionException} is routed to the global error handler via
502
+ * {@link RxJavaPlugins#onError(Throwable)}. To avoid shutdown-reladed problems, it is recommended
503
+ * all flows using the returned {@code Scheduler} to be canceled/disposed before the underlying
504
+ * {@code Executor} is shut down. To avoid problems due to the {@code Executor} having a bounded-queue,
505
+ * it is recommended to rephrase the flow to utilize backpressure as the means to limit outstanding work.
506
+ * <p>
477
507
* This type of scheduler is less sensitive to leaking {@link io.reactivex.rxjava3.core.Scheduler.Worker Scheduler.Worker} instances, although
478
508
* not disposing a worker that has timed/delayed tasks not cancelled by other means may leak resources and/or
479
509
* execute those tasks "unexpectedly".
0 commit comments