public final class RxJavaPlugins extends Object
Modifier and Type | Method and Description |
---|---|
static @NonNull Scheduler |
createComputationScheduler(@NonNull ThreadFactory threadFactory)
Create an instance of the default
Scheduler used for Schedulers.computation()
except using threadFactory for thread creation. |
static @NonNull Scheduler |
createExecutorScheduler(@NonNull Executor executor,
boolean interruptibleWorker,
boolean fair)
|
static @NonNull Scheduler |
createIoScheduler(@NonNull ThreadFactory threadFactory)
Create an instance of the default
Scheduler used for Schedulers.io()
except using threadFactory for thread creation. |
static @NonNull Scheduler |
createNewThreadScheduler(@NonNull ThreadFactory threadFactory)
Create an instance of the default
Scheduler used for Schedulers.newThread()
except using threadFactory for thread creation. |
static @NonNull Scheduler |
createSingleScheduler(@NonNull ThreadFactory threadFactory)
Create an instance of the default
Scheduler used for Schedulers.single()
except using threadFactory for thread creation. |
static @Nullable Function<? super Scheduler,? extends Scheduler> |
getComputationSchedulerHandler()
Returns the current hook function.
|
static @Nullable Consumer<? super Throwable> |
getErrorHandler()
Returns the a hook consumer.
|
static @Nullable Function<? super Supplier<Scheduler>,? extends Scheduler> |
getInitComputationSchedulerHandler()
Returns the current hook function.
|
static @Nullable Function<? super Supplier<Scheduler>,? extends Scheduler> |
getInitIoSchedulerHandler()
Returns the current hook function.
|
static @Nullable Function<? super Supplier<Scheduler>,? extends Scheduler> |
getInitNewThreadSchedulerHandler()
Returns the current hook function.
|
static @Nullable Function<? super Supplier<Scheduler>,? extends Scheduler> |
getInitSingleSchedulerHandler()
Returns the current hook function.
|
static @Nullable Function<? super Scheduler,? extends Scheduler> |
getIoSchedulerHandler()
Returns the current hook function.
|
static @Nullable Function<? super Scheduler,? extends Scheduler> |
getNewThreadSchedulerHandler()
Returns the current hook function.
|
static @Nullable BooleanSupplier |
getOnBeforeBlocking()
Returns the current blocking handler or null if no custom handler
is set.
|
static @Nullable Function<? super Completable,? extends Completable> |
getOnCompletableAssembly()
Returns the current hook function.
|
static @Nullable BiFunction<? super Completable,? super CompletableObserver,? extends CompletableObserver> |
getOnCompletableSubscribe()
Returns the current hook function.
|
static @Nullable Function<? super ConnectableFlowable,? extends ConnectableFlowable> |
getOnConnectableFlowableAssembly()
Returns the current hook function.
|
static @Nullable Function<? super ConnectableObservable,? extends ConnectableObservable> |
getOnConnectableObservableAssembly()
Returns the current hook function.
|
static @Nullable Function<? super Flowable,? extends Flowable> |
getOnFlowableAssembly()
Returns the current hook function.
|
static @Nullable BiFunction<? super Flowable,? super Subscriber,? extends Subscriber> |
getOnFlowableSubscribe()
Returns the current hook function.
|
static @Nullable Function<? super Maybe,? extends Maybe> |
getOnMaybeAssembly()
Returns the current hook function.
|
static @Nullable BiFunction<? super Maybe,? super MaybeObserver,? extends MaybeObserver> |
getOnMaybeSubscribe()
Returns the current hook function.
|
static @Nullable Function<? super Observable,? extends Observable> |
getOnObservableAssembly()
Returns the current hook function.
|
static @Nullable BiFunction<? super Observable,? super Observer,? extends Observer> |
getOnObservableSubscribe()
Returns the current hook function.
|
static @Nullable Function<? super ParallelFlowable,? extends ParallelFlowable> |
getOnParallelAssembly()
Returns the current hook function.
|
static @Nullable BiFunction<? super ParallelFlowable,? super Subscriber[],? extends Subscriber[]> |
getOnParallelSubscribe()
Returns the current hook function.
|
static @Nullable Function<? super Single,? extends Single> |
getOnSingleAssembly()
Returns the current hook function.
|
static @Nullable BiFunction<? super Single,? super SingleObserver,? extends SingleObserver> |
getOnSingleSubscribe()
Returns the current hook function.
|
static @Nullable Function<? super Runnable,? extends Runnable> |
getScheduleHandler()
Returns the current hook function.
|
static @Nullable Function<? super Scheduler,? extends Scheduler> |
getSingleSchedulerHandler()
Returns the current hook function.
|
static @NonNull Scheduler |
initComputationScheduler(@NonNull Supplier<Scheduler> defaultScheduler)
Calls the associated hook function.
|
static @NonNull Scheduler |
initIoScheduler(@NonNull Supplier<Scheduler> defaultScheduler)
Calls the associated hook function.
|
static @NonNull Scheduler |
initNewThreadScheduler(@NonNull Supplier<Scheduler> defaultScheduler)
Calls the associated hook function.
|
static @NonNull Scheduler |
initSingleScheduler(@NonNull Supplier<Scheduler> defaultScheduler)
Calls the associated hook function.
|
static boolean |
isFailOnNonBlockingScheduler()
Returns true if the blockingX operators fail
with an IllegalStateException on a non-blocking scheduler
such as computation or single.
|
static boolean |
isLockdown()
Returns true if the plugins were locked down.
|
static void |
lockdown()
Prevents changing the plugins from then on.
|
static @NonNull Completable |
onAssembly(@NonNull Completable source)
Calls the associated hook function.
|
static <T> @NonNull ConnectableFlowable<T> |
onAssembly(@NonNull ConnectableFlowable<T> source)
Calls the associated hook function.
|
static <T> @NonNull ConnectableObservable<T> |
onAssembly(@NonNull ConnectableObservable<T> source)
Calls the associated hook function.
|
static <T> @NonNull Flowable<T> |
onAssembly(@NonNull Flowable<T> source)
Calls the associated hook function.
|
static <T> @NonNull Maybe<T> |
onAssembly(@NonNull Maybe<T> source)
Calls the associated hook function.
|
static <T> @NonNull Observable<T> |
onAssembly(@NonNull Observable<T> source)
Calls the associated hook function.
|
static <T> @NonNull ParallelFlowable<T> |
onAssembly(@NonNull ParallelFlowable<T> source)
Calls the associated hook function.
|
static <T> @NonNull Single<T> |
onAssembly(@NonNull Single<T> source)
Calls the associated hook function.
|
static boolean |
onBeforeBlocking()
Called before an operator attempts a blocking operation
such as awaiting a condition or signal
and should return true to indicate the operator
should not block but throw an IllegalArgumentException.
|
static @NonNull Scheduler |
onComputationScheduler(@NonNull Scheduler defaultScheduler)
Calls the associated hook function.
|
static void |
onError(@NonNull Throwable error)
Called when an undeliverable error occurs.
|
static @NonNull Scheduler |
onIoScheduler(@NonNull Scheduler defaultScheduler)
Calls the associated hook function.
|
static @NonNull Scheduler |
onNewThreadScheduler(@NonNull Scheduler defaultScheduler)
Calls the associated hook function.
|
static @NonNull Runnable |
onSchedule(@NonNull Runnable run)
Called when a task is scheduled.
|
static @NonNull Scheduler |
onSingleScheduler(@NonNull Scheduler defaultScheduler)
Calls the associated hook function.
|
static @NonNull CompletableObserver |
onSubscribe(@NonNull Completable source,
@NonNull CompletableObserver observer)
Calls the associated hook function.
|
static <T> @NonNull Subscriber<? super T> |
onSubscribe(@NonNull Flowable<T> source,
@NonNull Subscriber<? super T> subscriber)
Calls the associated hook function.
|
static <T> @NonNull MaybeObserver<? super T> |
onSubscribe(@NonNull Maybe<T> source,
@NonNull MaybeObserver<? super T> observer)
Calls the associated hook function.
|
static <T> @NonNull Observer<? super T> |
onSubscribe(@NonNull Observable<T> source,
@NonNull Observer<? super T> observer)
Calls the associated hook function.
|
static <T> @NonNull Subscriber<? super T>[] |
onSubscribe(@NonNull ParallelFlowable<T> source,
@NonNull Subscriber<? super T>[] subscribers)
Calls the associated hook function.
|
static <T> @NonNull SingleObserver<? super T> |
onSubscribe(@NonNull Single<T> source,
@NonNull SingleObserver<? super T> observer)
Calls the associated hook function.
|
static void |
reset()
Removes all handlers and resets to default behavior.
|
static void |
setComputationSchedulerHandler(@Nullable Function<? super Scheduler,? extends Scheduler> handler)
Sets the specific hook function.
|
static void |
setErrorHandler(@Nullable Consumer<? super Throwable> handler)
Sets the specific hook function.
|
static void |
setFailOnNonBlockingScheduler(boolean enable)
Enables or disables the blockingX operators to fail
with an IllegalStateException on a non-blocking
scheduler such as computation or single.
|
static void |
setInitComputationSchedulerHandler(@Nullable Function<? super Supplier<Scheduler>,? extends Scheduler> handler)
Sets the specific hook function.
|
static void |
setInitIoSchedulerHandler(@Nullable Function<? super Supplier<Scheduler>,? extends Scheduler> handler)
Sets the specific hook function.
|
static void |
setInitNewThreadSchedulerHandler(@Nullable Function<? super Supplier<Scheduler>,? extends Scheduler> handler)
Sets the specific hook function.
|
static void |
setInitSingleSchedulerHandler(@Nullable Function<? super Supplier<Scheduler>,? extends Scheduler> handler)
Sets the specific hook function.
|
static void |
setIoSchedulerHandler(@Nullable Function<? super Scheduler,? extends Scheduler> handler)
Sets the specific hook function.
|
static void |
setNewThreadSchedulerHandler(@Nullable Function<? super Scheduler,? extends Scheduler> handler)
Sets the specific hook function.
|
static void |
setOnBeforeBlocking(@Nullable BooleanSupplier handler)
Set the handler that is called when an operator attempts a blocking
await; the handler should return true to prevent the blocking
and to signal an IllegalStateException instead.
|
static void |
setOnCompletableAssembly(@Nullable Function<? super Completable,? extends Completable> onCompletableAssembly)
Sets the specific hook function.
|
static void |
setOnCompletableSubscribe(@Nullable BiFunction<? super Completable,? super CompletableObserver,? extends CompletableObserver> onCompletableSubscribe)
Sets the specific hook function.
|
static void |
setOnConnectableFlowableAssembly(@Nullable Function<? super ConnectableFlowable,? extends ConnectableFlowable> onConnectableFlowableAssembly)
Sets the specific hook function.
|
static void |
setOnConnectableObservableAssembly(@Nullable Function<? super ConnectableObservable,? extends ConnectableObservable> onConnectableObservableAssembly)
Sets the specific hook function.
|
static void |
setOnFlowableAssembly(@Nullable Function<? super Flowable,? extends Flowable> onFlowableAssembly)
Sets the specific hook function.
|
static void |
setOnFlowableSubscribe(@Nullable BiFunction<? super Flowable,? super Subscriber,? extends Subscriber> onFlowableSubscribe)
Sets the specific hook function.
|
static void |
setOnMaybeAssembly(@Nullable Function<? super Maybe,? extends Maybe> onMaybeAssembly)
Sets the specific hook function.
|
static void |
setOnMaybeSubscribe(@Nullable BiFunction<? super Maybe,MaybeObserver,? extends MaybeObserver> onMaybeSubscribe)
Sets the specific hook function.
|
static void |
setOnObservableAssembly(@Nullable Function<? super Observable,? extends Observable> onObservableAssembly)
Sets the specific hook function.
|
static void |
setOnObservableSubscribe(@Nullable BiFunction<? super Observable,? super Observer,? extends Observer> onObservableSubscribe)
Sets the specific hook function.
|
static void |
setOnParallelAssembly(@Nullable Function<? super ParallelFlowable,? extends ParallelFlowable> handler)
Sets the specific hook function.
|
static void |
setOnParallelSubscribe(@Nullable BiFunction<? super ParallelFlowable,? super Subscriber[],? extends Subscriber[]> handler)
Sets the specific hook function.
|
static void |
setOnSingleAssembly(@Nullable Function<? super Single,? extends Single> onSingleAssembly)
Sets the specific hook function.
|
static void |
setOnSingleSubscribe(@Nullable BiFunction<? super Single,? super SingleObserver,? extends SingleObserver> onSingleSubscribe)
Sets the specific hook function.
|
static void |
setScheduleHandler(@Nullable Function<? super Runnable,? extends Runnable> handler)
Sets the specific hook function.
|
static void |
setSingleSchedulerHandler(@Nullable Function<? super Scheduler,? extends Scheduler> handler)
Sets the specific hook function.
|
public static void lockdown()
This allows container-like environments to prevent clients messing with plugins.
public static boolean isLockdown()
public static void setFailOnNonBlockingScheduler(boolean enable)
History: 2.0.5 - experimental
enable
- enable or disable the featurepublic static boolean isFailOnNonBlockingScheduler()
History: 2.0.5 - experimental
@Nullable public static @Nullable Function<? super Scheduler,? extends Scheduler> getComputationSchedulerHandler()
@Nullable public static @Nullable Consumer<? super Throwable> getErrorHandler()
@Nullable public static @Nullable Function<? super Supplier<Scheduler>,? extends Scheduler> getInitComputationSchedulerHandler()
@Nullable public static @Nullable Function<? super Supplier<Scheduler>,? extends Scheduler> getInitIoSchedulerHandler()
@Nullable public static @Nullable Function<? super Supplier<Scheduler>,? extends Scheduler> getInitNewThreadSchedulerHandler()
@Nullable public static @Nullable Function<? super Supplier<Scheduler>,? extends Scheduler> getInitSingleSchedulerHandler()
@Nullable public static @Nullable Function<? super Scheduler,? extends Scheduler> getIoSchedulerHandler()
@Nullable public static @Nullable Function<? super Scheduler,? extends Scheduler> getNewThreadSchedulerHandler()
@Nullable public static @Nullable Function<? super Runnable,? extends Runnable> getScheduleHandler()
@Nullable public static @Nullable Function<? super Scheduler,? extends Scheduler> getSingleSchedulerHandler()
@NonNull public static @NonNull Scheduler initComputationScheduler(@NonNull Supplier<Scheduler> defaultScheduler)
defaultScheduler
- a Supplier
which returns the hook's input valueNullPointerException
- if the supplier parameter or its result are null@NonNull public static @NonNull Scheduler initIoScheduler(@NonNull Supplier<Scheduler> defaultScheduler)
defaultScheduler
- a Supplier
which returns the hook's input valueNullPointerException
- if the supplier parameter or its result are null@NonNull public static @NonNull Scheduler initNewThreadScheduler(@NonNull Supplier<Scheduler> defaultScheduler)
defaultScheduler
- a Supplier
which returns the hook's input valueNullPointerException
- if the supplier parameter or its result are null@NonNull public static @NonNull Scheduler initSingleScheduler(@NonNull Supplier<Scheduler> defaultScheduler)
defaultScheduler
- a Supplier
which returns the hook's input valueNullPointerException
- if the supplier parameter or its result are null@NonNull public static @NonNull Scheduler onComputationScheduler(@NonNull Scheduler defaultScheduler)
defaultScheduler
- the hook's input valuepublic static void onError(@NonNull Throwable error)
Undeliverable errors are those Observer.onError()
invocations that are not allowed to happen on
the given consumer type (Observer
, Subscriber
, etc.) due to protocol restrictions
because the consumer has either disposed/cancelled its Disposable
/Subscription
or
has already terminated with an onError()
or onComplete()
signal.
By default, this global error handler prints the stacktrace via Throwable.printStackTrace()
and calls Thread.UncaughtExceptionHandler.uncaughtException(Thread, Throwable)
on the current thread.
Note that on some platforms, the platform runtime terminates the current application with an error if such
uncaught exceptions happen. In this case, it is recommended the application installs a global error
handler via the setErrorHandler(Consumer)
plugin method.
error
- the error to reportgetErrorHandler()
,
setErrorHandler(Consumer)
,
Error handling Wiki@NonNull public static @NonNull Scheduler onIoScheduler(@NonNull Scheduler defaultScheduler)
defaultScheduler
- the hook's input value@NonNull public static @NonNull Scheduler onNewThreadScheduler(@NonNull Scheduler defaultScheduler)
defaultScheduler
- the hook's input value@NonNull public static @NonNull Runnable onSchedule(@NonNull Runnable run)
run
- the runnable instance@NonNull public static @NonNull Scheduler onSingleScheduler(@NonNull Scheduler defaultScheduler)
defaultScheduler
- the hook's input valuepublic static void reset()
public static void setComputationSchedulerHandler(@Nullable Function<? super Scheduler,? extends Scheduler> handler)
handler
- the hook function to set, null allowedpublic static void setErrorHandler(@Nullable Consumer<? super Throwable> handler)
handler
- the hook function to set, null allowedpublic static void setInitComputationSchedulerHandler(@Nullable Function<? super Supplier<Scheduler>,? extends Scheduler> handler)
handler
- the hook function to set, null allowed, but the function may not return nullpublic static void setInitIoSchedulerHandler(@Nullable Function<? super Supplier<Scheduler>,? extends Scheduler> handler)
handler
- the hook function to set, null allowed, but the function may not return nullpublic static void setInitNewThreadSchedulerHandler(@Nullable Function<? super Supplier<Scheduler>,? extends Scheduler> handler)
handler
- the hook function to set, null allowed, but the function may not return nullpublic static void setInitSingleSchedulerHandler(@Nullable Function<? super Supplier<Scheduler>,? extends Scheduler> handler)
handler
- the hook function to set, null allowed, but the function may not return nullpublic static void setIoSchedulerHandler(@Nullable Function<? super Scheduler,? extends Scheduler> handler)
handler
- the hook function to set, null allowedpublic static void setNewThreadSchedulerHandler(@Nullable Function<? super Scheduler,? extends Scheduler> handler)
handler
- the hook function to set, null allowedpublic static void setScheduleHandler(@Nullable Function<? super Runnable,? extends Runnable> handler)
handler
- the hook function to set, null allowedpublic static void setSingleSchedulerHandler(@Nullable Function<? super Scheduler,? extends Scheduler> handler)
handler
- the hook function to set, null allowed@Nullable public static @Nullable Function<? super Completable,? extends Completable> getOnCompletableAssembly()
@Nullable public static @Nullable BiFunction<? super Completable,? super CompletableObserver,? extends CompletableObserver> getOnCompletableSubscribe()
@Nullable public static @Nullable Function<? super Flowable,? extends Flowable> getOnFlowableAssembly()
@Nullable public static @Nullable Function<? super ConnectableFlowable,? extends ConnectableFlowable> getOnConnectableFlowableAssembly()
@Nullable public static @Nullable BiFunction<? super Flowable,? super Subscriber,? extends Subscriber> getOnFlowableSubscribe()
@Nullable public static @Nullable BiFunction<? super Maybe,? super MaybeObserver,? extends MaybeObserver> getOnMaybeSubscribe()
@Nullable public static @Nullable Function<? super Maybe,? extends Maybe> getOnMaybeAssembly()
@Nullable public static @Nullable Function<? super Single,? extends Single> getOnSingleAssembly()
@Nullable public static @Nullable BiFunction<? super Single,? super SingleObserver,? extends SingleObserver> getOnSingleSubscribe()
@Nullable public static @Nullable Function<? super Observable,? extends Observable> getOnObservableAssembly()
@Nullable public static @Nullable Function<? super ConnectableObservable,? extends ConnectableObservable> getOnConnectableObservableAssembly()
@Nullable public static @Nullable BiFunction<? super Observable,? super Observer,? extends Observer> getOnObservableSubscribe()
public static void setOnCompletableAssembly(@Nullable Function<? super Completable,? extends Completable> onCompletableAssembly)
onCompletableAssembly
- the hook function to set, null allowedpublic static void setOnCompletableSubscribe(@Nullable BiFunction<? super Completable,? super CompletableObserver,? extends CompletableObserver> onCompletableSubscribe)
onCompletableSubscribe
- the hook function to set, null allowedpublic static void setOnFlowableAssembly(@Nullable Function<? super Flowable,? extends Flowable> onFlowableAssembly)
onFlowableAssembly
- the hook function to set, null allowedpublic static void setOnMaybeAssembly(@Nullable Function<? super Maybe,? extends Maybe> onMaybeAssembly)
onMaybeAssembly
- the hook function to set, null allowedpublic static void setOnConnectableFlowableAssembly(@Nullable Function<? super ConnectableFlowable,? extends ConnectableFlowable> onConnectableFlowableAssembly)
onConnectableFlowableAssembly
- the hook function to set, null allowedpublic static void setOnFlowableSubscribe(@Nullable BiFunction<? super Flowable,? super Subscriber,? extends Subscriber> onFlowableSubscribe)
onFlowableSubscribe
- the hook function to set, null allowedpublic static void setOnMaybeSubscribe(@Nullable BiFunction<? super Maybe,MaybeObserver,? extends MaybeObserver> onMaybeSubscribe)
onMaybeSubscribe
- the hook function to set, null allowedpublic static void setOnObservableAssembly(@Nullable Function<? super Observable,? extends Observable> onObservableAssembly)
onObservableAssembly
- the hook function to set, null allowedpublic static void setOnConnectableObservableAssembly(@Nullable Function<? super ConnectableObservable,? extends ConnectableObservable> onConnectableObservableAssembly)
onConnectableObservableAssembly
- the hook function to set, null allowedpublic static void setOnObservableSubscribe(@Nullable BiFunction<? super Observable,? super Observer,? extends Observer> onObservableSubscribe)
onObservableSubscribe
- the hook function to set, null allowedpublic static void setOnSingleAssembly(@Nullable Function<? super Single,? extends Single> onSingleAssembly)
onSingleAssembly
- the hook function to set, null allowedpublic static void setOnSingleSubscribe(@Nullable BiFunction<? super Single,? super SingleObserver,? extends SingleObserver> onSingleSubscribe)
onSingleSubscribe
- the hook function to set, null allowed@NonNull public static <T> @NonNull Subscriber<? super T> onSubscribe(@NonNull Flowable<T> source, @NonNull Subscriber<? super T> subscriber)
T
- the value typesource
- the hook's input valuesubscriber
- the subscriber@NonNull public static <T> @NonNull Observer<? super T> onSubscribe(@NonNull Observable<T> source, @NonNull Observer<? super T> observer)
T
- the value typesource
- the hook's input valueobserver
- the observer@NonNull public static <T> @NonNull SingleObserver<? super T> onSubscribe(@NonNull Single<T> source, @NonNull SingleObserver<? super T> observer)
T
- the value typesource
- the hook's input valueobserver
- the observer@NonNull public static @NonNull CompletableObserver onSubscribe(@NonNull Completable source, @NonNull CompletableObserver observer)
source
- the hook's input valueobserver
- the observer@NonNull public static <T> @NonNull MaybeObserver<? super T> onSubscribe(@NonNull Maybe<T> source, @NonNull MaybeObserver<? super T> observer)
T
- the value typesource
- the hook's input valueobserver
- the subscriber@NonNull public static <T> @NonNull Subscriber<? super T>[] onSubscribe(@NonNull ParallelFlowable<T> source, @NonNull Subscriber<? super T>[] subscribers)
T
- the value typesource
- the hook's input valuesubscribers
- the array of subscribers@NonNull public static <T> @NonNull Maybe<T> onAssembly(@NonNull Maybe<T> source)
T
- the value typesource
- the hook's input value@NonNull public static <T> @NonNull Flowable<T> onAssembly(@NonNull Flowable<T> source)
T
- the value typesource
- the hook's input value@NonNull public static <T> @NonNull ConnectableFlowable<T> onAssembly(@NonNull ConnectableFlowable<T> source)
T
- the value typesource
- the hook's input value@NonNull public static <T> @NonNull Observable<T> onAssembly(@NonNull Observable<T> source)
T
- the value typesource
- the hook's input value@NonNull public static <T> @NonNull ConnectableObservable<T> onAssembly(@NonNull ConnectableObservable<T> source)
T
- the value typesource
- the hook's input value@NonNull public static <T> @NonNull Single<T> onAssembly(@NonNull Single<T> source)
T
- the value typesource
- the hook's input value@NonNull public static @NonNull Completable onAssembly(@NonNull Completable source)
source
- the hook's input valuepublic static void setOnParallelAssembly(@Nullable Function<? super ParallelFlowable,? extends ParallelFlowable> handler)
History: 2.0.6 - experimental; 2.1 - beta
handler
- the hook function to set, null allowed@Nullable public static @Nullable Function<? super ParallelFlowable,? extends ParallelFlowable> getOnParallelAssembly()
History: 2.0.6 - experimental; 2.1 - beta
public static void setOnParallelSubscribe(@Nullable BiFunction<? super ParallelFlowable,? super Subscriber[],? extends Subscriber[]> handler)
History: 3.0.11 - experimental
handler
- the hook function to set, null allowed@Nullable public static @Nullable BiFunction<? super ParallelFlowable,? super Subscriber[],? extends Subscriber[]> getOnParallelSubscribe()
History: 3.0.11 - experimental
@NonNull public static <T> @NonNull ParallelFlowable<T> onAssembly(@NonNull ParallelFlowable<T> source)
History: 2.0.6 - experimental; 2.1 - beta
T
- the value type of the sourcesource
- the hook's input valuepublic static boolean onBeforeBlocking()
History: 2.0.5 - experimental
setFailOnNonBlockingScheduler(boolean)
public static void setOnBeforeBlocking(@Nullable BooleanSupplier handler)
History: 2.0.5 - experimental
handler
- the handler to set, null resets to the default handler
that always returns falseonBeforeBlocking()
@Nullable public static @Nullable BooleanSupplier getOnBeforeBlocking()
History: 2.0.5 - experimental
@NonNull public static @NonNull Scheduler createComputationScheduler(@NonNull ThreadFactory threadFactory)
Scheduler
used for Schedulers.computation()
except using threadFactory
for thread creation.
History: 2.0.5 - experimental
threadFactory
- thread factory to use for creating worker threads. Note that this takes precedence over any
system properties for configuring new thread creation. Cannot be null.@NonNull public static @NonNull Scheduler createIoScheduler(@NonNull ThreadFactory threadFactory)
Scheduler
used for Schedulers.io()
except using threadFactory
for thread creation.
History: 2.0.5 - experimental
threadFactory
- thread factory to use for creating worker threads. Note that this takes precedence over any
system properties for configuring new thread creation. Cannot be null.@NonNull public static @NonNull Scheduler createNewThreadScheduler(@NonNull ThreadFactory threadFactory)
Scheduler
used for Schedulers.newThread()
except using threadFactory
for thread creation.
History: 2.0.5 - experimental
threadFactory
- thread factory to use for creating worker threads. Note that this takes precedence over any
system properties for configuring new thread creation. Cannot be null.@NonNull public static @NonNull Scheduler createSingleScheduler(@NonNull ThreadFactory threadFactory)
Scheduler
used for Schedulers.single()
except using threadFactory
for thread creation.
History: 2.0.5 - experimental
threadFactory
- thread factory to use for creating worker threads. Note that this takes precedence over any
system properties for configuring new thread creation. Cannot be null.@NonNull public static @NonNull Scheduler createExecutorScheduler(@NonNull Executor executor, boolean interruptibleWorker, boolean fair)
Scheduler
by wrapping an existing Executor
.
This method allows creating an Executor
-backed Scheduler
before the Schedulers
class
would initialize the standard Scheduler
s.
executor
- the Executor
to wrap and turn into a Scheduler
.interruptibleWorker
- if true
, the tasks submitted to the Scheduler.Worker
will
be interrupted when the task is disposed.fair
- if true
, tasks submitted to the Scheduler
or Worker
will be executed by the underlying Executor
one after the other, still
in a FIFO and non-overlapping manner, but allows interleaving with other tasks submitted to the underlying Executor
.
If false
, the underlying FIFO scheme will execute as many tasks as it can before giving up the underlying Executor
thread.Scheduler
wrapping the Executor