Skip to content

Commit 8b4d461

Browse files
committed
Move to RxJavaPlugins
1 parent 681b977 commit 8b4d461

File tree

2 files changed

+100
-100
lines changed

2 files changed

+100
-100
lines changed

src/main/java/io/reactivex/plugins/RxJavaPlugins.java

Lines changed: 100 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,19 @@
1212
*/
1313
package io.reactivex.plugins;
1414

15-
import java.lang.Thread.UncaughtExceptionHandler;
16-
import java.util.concurrent.Callable;
17-
18-
import io.reactivex.internal.functions.ObjectHelper;
19-
import org.reactivestreams.Subscriber;
20-
2115
import io.reactivex.*;
16+
import io.reactivex.annotations.Experimental;
2217
import io.reactivex.flowables.ConnectableFlowable;
2318
import io.reactivex.functions.*;
19+
import io.reactivex.internal.functions.ObjectHelper;
20+
import io.reactivex.internal.schedulers.*;
2421
import io.reactivex.internal.util.ExceptionHelper;
2522
import io.reactivex.observables.ConnectableObservable;
23+
import io.reactivex.schedulers.Schedulers;
24+
import org.reactivestreams.Subscriber;
25+
26+
import java.lang.Thread.UncaughtExceptionHandler;
27+
import java.util.concurrent.*;
2628

2729
/**
2830
* Utility class to inject handlers to certain standard RxJava operations.
@@ -926,6 +928,98 @@ public static Completable onAssembly(Completable source) {
926928
return source;
927929
}
928930

931+
/**
932+
* Create an instance of the default {@link Scheduler} used for {@link Schedulers#computation()}.
933+
* @return the created Scheduler instance
934+
* @since 2.0.5 - experimental
935+
*/
936+
@Experimental
937+
public static Scheduler newComputation() {
938+
return new ComputationScheduler();
939+
}
940+
941+
/**
942+
* Create an instance of the default {@link Scheduler} used for {@link Schedulers#computation()}
943+
* except using {@code threadFactory} for thread creation.
944+
* @param threadFactory thread factory to use for creating worker threads. Note that this takes precedence over any
945+
* system properties for configuring new thread creation. Cannot be null.
946+
* @return the created Scheduler instance
947+
* @since 2.0.5 - experimental
948+
*/
949+
@Experimental
950+
public static Scheduler newComputation(ThreadFactory threadFactory) {
951+
return new ComputationScheduler(ObjectHelper.requireNonNull(threadFactory, "threadFactory is null"));
952+
}
953+
954+
/**
955+
* Create an instance of the default {@link Scheduler} used for {@link Schedulers#io()}.
956+
* @return the created Scheduler instance
957+
* @since 2.0.5 - experimental
958+
*/
959+
@Experimental
960+
public static Scheduler newIo() {
961+
return new IoScheduler();
962+
}
963+
964+
/**
965+
* Create an instance of the default {@link Scheduler} used for {@link Schedulers#io()}
966+
* except using {@code threadFactory} for thread creation.
967+
* @param threadFactory thread factory to use for creating worker threads. Note that this takes precedence over any
968+
* system properties for configuring new thread creation. Cannot be null.
969+
* @return the created Scheduler instance
970+
* @since 2.0.5 - experimental
971+
*/
972+
@Experimental
973+
public static Scheduler newIo(ThreadFactory threadFactory) {
974+
return new IoScheduler(ObjectHelper.requireNonNull(threadFactory, "threadFactory is null"));
975+
}
976+
977+
/**
978+
* Create an instance of the default {@link Scheduler} used for {@link Schedulers#newThread()}.
979+
* @return the created Scheduler instance
980+
* @since 2.0.5 - experimental
981+
*/
982+
@Experimental
983+
public static Scheduler newNewThread() {
984+
return new NewThreadScheduler();
985+
}
986+
987+
/**
988+
* Create an instance of the default {@link Scheduler} used for {@link Schedulers#newThread()}
989+
* except using {@code threadFactory} for thread creation.
990+
* @param threadFactory thread factory to use for creating worker threads. Note that this takes precedence over any
991+
* system properties for configuring new thread creation. Cannot be null.
992+
* @return the created Scheduler instance
993+
* @since 2.0.5 - experimental
994+
*/
995+
@Experimental
996+
public static Scheduler newNewThread(ThreadFactory threadFactory) {
997+
return new NewThreadScheduler(ObjectHelper.requireNonNull(threadFactory, "threadFactory is null"));
998+
}
999+
1000+
/**
1001+
* Create an instance of the default {@link Scheduler} used for {@link Schedulers#single()}.
1002+
* @return the created Scheduler instance
1003+
* @since 2.0.5 - experimental
1004+
*/
1005+
@Experimental
1006+
public static Scheduler newSingle() {
1007+
return new SingleScheduler();
1008+
}
1009+
1010+
/**
1011+
* Create an instance of the default {@link Scheduler} used for {@link Schedulers#single()}
1012+
* except using {@code threadFactory} for thread creation.
1013+
* @param threadFactory thread factory to use for creating worker threads. Note that this takes precedence over any
1014+
* system properties for configuring new thread creation. Cannot be null.
1015+
* @return the created Scheduler instance
1016+
* @since 2.0.5 - experimental
1017+
*/
1018+
@Experimental
1019+
public static Scheduler newSingle(ThreadFactory threadFactory) {
1020+
return new SingleScheduler(ObjectHelper.requireNonNull(threadFactory, "threadFactory is null"));
1021+
}
1022+
9291023
/**
9301024
* Wraps the call to the function in try-catch and propagates thrown
9311025
* checked exceptions as RuntimeException.

src/main/java/io/reactivex/schedulers/Schedulers.java

Lines changed: 0 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
package io.reactivex.schedulers;
1515

1616
import io.reactivex.Scheduler;
17-
import io.reactivex.annotations.Experimental;
18-
import io.reactivex.internal.functions.ObjectHelper;
1917
import io.reactivex.internal.schedulers.*;
2018
import io.reactivex.plugins.RxJavaPlugins;
2119

@@ -180,98 +178,6 @@ public static Scheduler from(Executor executor) {
180178
return new ExecutorScheduler(executor);
181179
}
182180

183-
/**
184-
* Create an instance of the default {@link Scheduler} used for {@link Schedulers#computation()}.
185-
* @return the created Scheduler instance
186-
* @since 2.0.5 - experimental
187-
*/
188-
@Experimental
189-
public static Scheduler newComputation() {
190-
return new ComputationScheduler();
191-
}
192-
193-
/**
194-
* Create an instance of the default {@link Scheduler} used for {@link Schedulers#computation()}
195-
* except using {@code threadFactory} for thread creation.
196-
* @param threadFactory thread factory to use for creating worker threads. Note that this takes precedence over any
197-
* system properties for configuring new thread creation. Cannot be null.
198-
* @return the created Scheduler instance
199-
* @since 2.0.5 - experimental
200-
*/
201-
@Experimental
202-
public static Scheduler newComputation(ThreadFactory threadFactory) {
203-
return new ComputationScheduler(ObjectHelper.requireNonNull(threadFactory, "threadFactory is null"));
204-
}
205-
206-
/**
207-
* Create an instance of the default {@link Scheduler} used for {@link Schedulers#io()}.
208-
* @return the created Scheduler instance
209-
* @since 2.0.5 - experimental
210-
*/
211-
@Experimental
212-
public static Scheduler newIo() {
213-
return new IoScheduler();
214-
}
215-
216-
/**
217-
* Create an instance of the default {@link Scheduler} used for {@link Schedulers#io()}
218-
* except using {@code threadFactory} for thread creation.
219-
* @param threadFactory thread factory to use for creating worker threads. Note that this takes precedence over any
220-
* system properties for configuring new thread creation. Cannot be null.
221-
* @return the created Scheduler instance
222-
* @since 2.0.5 - experimental
223-
*/
224-
@Experimental
225-
public static Scheduler newIo(ThreadFactory threadFactory) {
226-
return new IoScheduler(ObjectHelper.requireNonNull(threadFactory, "threadFactory is null"));
227-
}
228-
229-
/**
230-
* Create an instance of the default {@link Scheduler} used for {@link Schedulers#newThread()}.
231-
* @return the created Scheduler instance
232-
* @since 2.0.5 - experimental
233-
*/
234-
@Experimental
235-
public static Scheduler newNewThread() {
236-
return new NewThreadScheduler();
237-
}
238-
239-
/**
240-
* Create an instance of the default {@link Scheduler} used for {@link Schedulers#newThread()}
241-
* except using {@code threadFactory} for thread creation.
242-
* @param threadFactory thread factory to use for creating worker threads. Note that this takes precedence over any
243-
* system properties for configuring new thread creation. Cannot be null.
244-
* @return the created Scheduler instance
245-
* @since 2.0.5 - experimental
246-
*/
247-
@Experimental
248-
public static Scheduler newNewThread(ThreadFactory threadFactory) {
249-
return new NewThreadScheduler(ObjectHelper.requireNonNull(threadFactory, "threadFactory is null"));
250-
}
251-
252-
/**
253-
* Create an instance of the default {@link Scheduler} used for {@link Schedulers#single()}.
254-
* @return the created Scheduler instance
255-
* @since 2.0.5 - experimental
256-
*/
257-
@Experimental
258-
public static Scheduler newSingle() {
259-
return new SingleScheduler();
260-
}
261-
262-
/**
263-
* Create an instance of the default {@link Scheduler} used for {@link Schedulers#single()}
264-
* except using {@code threadFactory} for thread creation.
265-
* @param threadFactory thread factory to use for creating worker threads. Note that this takes precedence over any
266-
* system properties for configuring new thread creation. Cannot be null.
267-
* @return the created Scheduler instance
268-
* @since 2.0.5 - experimental
269-
*/
270-
@Experimental
271-
public static Scheduler newSingle(ThreadFactory threadFactory) {
272-
return new SingleScheduler(ObjectHelper.requireNonNull(threadFactory, "threadFactory is null"));
273-
}
274-
275181
/**
276182
* Shuts down those standard Schedulers which support the SchedulerLifecycle interface.
277183
* <p>The operation is idempotent and thread-safe.

0 commit comments

Comments
 (0)