You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* <strong>Supported system properties ({@code System.getProperty()}):</strong>
27
31
* <ul>
28
32
* <li>{@code rx2.io-priority} (int): sets the thread priority of the {@link #io()} Scheduler, default is {@link Thread#NORM_PRIORITY}</li>
@@ -84,14 +88,46 @@ private Schedulers() {
84
88
}
85
89
86
90
/**
87
-
* Creates and returns a {@link Scheduler} intended for computational work.
91
+
* Returns a default, shared {@link Scheduler} instance intended for computational work.
88
92
* <p>
89
93
* This can be used for event-loops, processing callbacks and other computational work.
90
94
* <p>
91
-
* Do not perform IO-bound work on this scheduler. Use {@link #io()} instead.
95
+
* It is not recommended to perform blocking, IO-bound work on this scheduler. Use {@link #io()} instead.
96
+
* <p>
97
+
* The default instance has a backing pool of single-threaded {@link ScheduledExecutorService} instances equal to
98
+
* the number of available processors ({@link java.lang.Runtime#availableProcessors()}) to the Java VM.
92
99
* <p>
93
100
* Unhandled errors will be delivered to the scheduler Thread's {@link java.lang.Thread.UncaughtExceptionHandler}.
94
-
*
101
+
* <p>
102
+
* This type of scheduler is less sensitive to leaking {@link io.reactivex.Scheduler.Worker} instances, although
103
+
* not disposing a worker that has timed/delayed tasks not cancelled by other means may leak resources and/or
104
+
* execute those tasks "unexpectedly".
105
+
* <p>
106
+
* If the {@link RxJavaPlugins#setFailOnNonBlockingScheduler(boolean)} is set to true, attempting to execute
107
+
* operators that block while running on this scheduler will throw an {@link IllegalStateException}.
108
+
* <p>
109
+
* You can control certain properties of this standard scheduler via system properties that have to be set
110
+
* before the {@link Schedulers} class is referenced in your code.
111
+
* <br><strong>Supported system properties ({@code System.getProperty()}):</strong>
112
+
* <ul>
113
+
* <li>{@code rx2.computation-threads} (int): sets the number of threads in the {@link #computation()} Scheduler, default is the number of available CPUs</li>
114
+
* <li>{@code rx2.computation-priority} (int): sets the thread priority of the {@link #computation()} Scheduler, default is {@link Thread#NORM_PRIORITY}</li>
115
+
* </ul>
116
+
* <p>
117
+
* The default value of this scheduler can be overridden at initialization time via the
* instances queue work and execute them in a FIFO manner on one of the participating threads.
185
+
* <p>
186
+
* The default implementation's {@link Scheduler#scheduleDirect(Runnable)} methods execute the tasks on the current thread
187
+
* without any queueing and the timed overloads use blocking sleep as well.
188
+
* <p>
189
+
* Note that this scheduler can't be reliably used to return the execution of
190
+
* tasks to the "main" thread. Such behavior requires a blocking-queueing scheduler currently not provided
191
+
* by RxJava itself but may be found in external libraries.
192
+
* <p>
193
+
* This scheduler can't be overridden via an {@link RxJavaPlugins} method.
124
194
* @return a {@link Scheduler} that queues work on the current thread
125
195
*/
126
196
@NonNull
@@ -129,10 +199,37 @@ public static Scheduler trampoline() {
129
199
}
130
200
131
201
/**
132
-
* Creates and returns a {@link Scheduler} that creates a new {@link Thread} for each unit of work.
202
+
* Returns a default, shared {@link Scheduler} instance that creates a new {@link Thread} for each unit of work.
203
+
* <p>
204
+
* The default implementation of this scheduler creates a new, single-threaded {@link ScheduledExecutorService} for
205
+
* each invocation of the {@link Scheduler#scheduleDirect(Runnable)} (plus its overloads) and {@link Scheduler#createWorker()}
206
+
* methods, thus an unbounded number of worker threads may be created that can
207
+
* result in system slowdowns or {@code OutOfMemoryError}. Therefore, for casual uses or when implementing an operator,
208
+
* the Worker instances must be disposed via {@link io.reactivex.Scheduler.Worker#dispose()}.
133
209
* <p>
134
210
* Unhandled errors will be delivered to the scheduler Thread's {@link java.lang.Thread.UncaughtExceptionHandler}.
135
-
*
211
+
* <p>
212
+
* You can control certain properties of this standard scheduler via system properties that have to be set
213
+
* before the {@link Schedulers} class is referenced in your code.
214
+
* <br><strong>Supported system properties ({@code System.getProperty()}):</strong>
215
+
* <ul>
216
+
* <li>{@code rx2.newthread-priority} (int): sets the thread priority of the {@link #newThread()} Scheduler, default is {@link Thread#NORM_PRIORITY}</li>
217
+
* </ul>
218
+
* <p>
219
+
* The default value of this scheduler can be overridden at initialization time via the
0 commit comments