public final class RxJavaPlugins
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static Function<Scheduler,Scheduler> |
getComputationSchedulerHandler()
Returns the current hook function.
|
static Consumer<java.lang.Throwable> |
getErrorHandler()
Returns the a hook consumer.
|
static Function<java.util.concurrent.Callable<Scheduler>,Scheduler> |
getInitComputationSchedulerHandler()
Returns the current hook function.
|
static Function<java.util.concurrent.Callable<Scheduler>,Scheduler> |
getInitIoSchedulerHandler()
Returns the current hook function.
|
static Function<java.util.concurrent.Callable<Scheduler>,Scheduler> |
getInitNewThreadSchedulerHandler()
Returns the current hook function.
|
static Function<java.util.concurrent.Callable<Scheduler>,Scheduler> |
getInitSingleSchedulerHandler()
Returns the current hook function.
|
static Function<Scheduler,Scheduler> |
getIoSchedulerHandler()
Returns the current hook function.
|
static Function<Scheduler,Scheduler> |
getNewThreadSchedulerHandler()
Returns the current hook function.
|
static Function<Completable,Completable> |
getOnCompletableAssembly()
Returns the current hook function.
|
static BiFunction<Completable,CompletableObserver,CompletableObserver> |
getOnCompletableSubscribe()
Returns the current hook function.
|
static Function<ConnectableFlowable,ConnectableFlowable> |
getOnConnectableFlowableAssembly()
Returns the current hook function.
|
static Function<ConnectableObservable,ConnectableObservable> |
getOnConnectableObservableAssembly()
Returns the current hook function.
|
static Function<Flowable,Flowable> |
getOnFlowableAssembly()
Returns the current hook function.
|
static BiFunction<Flowable,org.reactivestreams.Subscriber,org.reactivestreams.Subscriber> |
getOnFlowableSubscribe()
Returns the current hook function.
|
static Function<Maybe,Maybe> |
getOnMaybeAssembly()
Returns the current hook function.
|
static BiFunction<Maybe,MaybeObserver,MaybeObserver> |
getOnMaybeSubscribe()
Returns the current hook function.
|
static Function<Observable,Observable> |
getOnObservableAssembly()
Returns the current hook function.
|
static BiFunction<Observable,Observer,Observer> |
getOnObservableSubscribe()
Returns the current hook function.
|
static Function<Single,Single> |
getOnSingleAssembly()
Returns the current hook function.
|
static BiFunction<Single,SingleObserver,SingleObserver> |
getOnSingleSubscribe()
Returns the current hook function.
|
static Function<java.lang.Runnable,java.lang.Runnable> |
getScheduleHandler()
Returns the current hook function.
|
static Function<Scheduler,Scheduler> |
getSingleSchedulerHandler()
Returns the current hook function.
|
static Scheduler |
initComputationScheduler(java.util.concurrent.Callable<Scheduler> defaultScheduler)
Calls the associated hook function.
|
static Scheduler |
initIoScheduler(java.util.concurrent.Callable<Scheduler> defaultScheduler)
Calls the associated hook function.
|
static Scheduler |
initNewThreadScheduler(java.util.concurrent.Callable<Scheduler> defaultScheduler)
Calls the associated hook function.
|
static Scheduler |
initSingleScheduler(java.util.concurrent.Callable<Scheduler> defaultScheduler)
Calls the associated hook function.
|
static boolean |
isLockdown()
Returns true if the plugins were locked down.
|
static void |
lockdown()
Prevents changing the plugins from then on.
|
static Completable |
onAssembly(Completable source)
Calls the associated hook function.
|
static <T> ConnectableFlowable<T> |
onAssembly(ConnectableFlowable<T> source)
Calls the associated hook function.
|
static <T> ConnectableObservable<T> |
onAssembly(ConnectableObservable<T> source)
Calls the associated hook function.
|
static <T> Flowable<T> |
onAssembly(Flowable<T> source)
Calls the associated hook function.
|
static <T> Maybe<T> |
onAssembly(Maybe<T> source)
Calls the associated hook function.
|
static <T> Observable<T> |
onAssembly(Observable<T> source)
Calls the associated hook function.
|
static <T> Single<T> |
onAssembly(Single<T> source)
Calls the associated hook function.
|
static Scheduler |
onComputationScheduler(Scheduler defaultScheduler)
Calls the associated hook function.
|
static void |
onError(java.lang.Throwable error)
Called when an undeliverable error occurs.
|
static Scheduler |
onIoScheduler(Scheduler defaultScheduler)
Calls the associated hook function.
|
static Scheduler |
onNewThreadScheduler(Scheduler defaultScheduler)
Calls the associated hook function.
|
static java.lang.Runnable |
onSchedule(java.lang.Runnable run)
Called when a task is scheduled.
|
static Scheduler |
onSingleScheduler(Scheduler defaultScheduler)
Calls the associated hook function.
|
static CompletableObserver |
onSubscribe(Completable source,
CompletableObserver observer)
Calls the associated hook function.
|
static <T> org.reactivestreams.Subscriber<? super T> |
onSubscribe(Flowable<T> source,
org.reactivestreams.Subscriber<? super T> subscriber)
Calls the associated hook function.
|
static <T> MaybeObserver<? super T> |
onSubscribe(Maybe<T> source,
MaybeObserver<? super T> subscriber)
Calls the associated hook function.
|
static <T> Observer<? super T> |
onSubscribe(Observable<T> source,
Observer<? super T> observer)
Calls the associated hook function.
|
static <T> SingleObserver<? super T> |
onSubscribe(Single<T> source,
SingleObserver<? super T> observer)
Calls the associated hook function.
|
static void |
reset()
Removes all handlers and resets to default behavior.
|
static void |
setComputationSchedulerHandler(Function<Scheduler,Scheduler> handler)
Sets the specific hook function.
|
static void |
setErrorHandler(Consumer<java.lang.Throwable> handler)
Sets the specific hook function.
|
static void |
setInitComputationSchedulerHandler(Function<java.util.concurrent.Callable<Scheduler>,Scheduler> handler)
Sets the specific hook function.
|
static void |
setInitIoSchedulerHandler(Function<java.util.concurrent.Callable<Scheduler>,Scheduler> handler)
Sets the specific hook function.
|
static void |
setInitNewThreadSchedulerHandler(Function<java.util.concurrent.Callable<Scheduler>,Scheduler> handler)
Sets the specific hook function.
|
static void |
setInitSingleSchedulerHandler(Function<java.util.concurrent.Callable<Scheduler>,Scheduler> handler)
Sets the specific hook function.
|
static void |
setIoSchedulerHandler(Function<Scheduler,Scheduler> handler)
Sets the specific hook function.
|
static void |
setNewThreadSchedulerHandler(Function<Scheduler,Scheduler> handler)
Sets the specific hook function.
|
static void |
setOnCompletableAssembly(Function<Completable,Completable> onCompletableAssembly)
Sets the specific hook function.
|
static void |
setOnCompletableSubscribe(BiFunction<Completable,CompletableObserver,CompletableObserver> onCompletableSubscribe)
Sets the specific hook function.
|
static void |
setOnConnectableFlowableAssembly(Function<ConnectableFlowable,ConnectableFlowable> onConnectableFlowableAssembly)
Sets the specific hook function.
|
static void |
setOnConnectableObservableAssembly(Function<ConnectableObservable,ConnectableObservable> onConnectableObservableAssembly)
Sets the specific hook function.
|
static void |
setOnFlowableAssembly(Function<Flowable,Flowable> onFlowableAssembly)
Sets the specific hook function.
|
static void |
setOnFlowableSubscribe(BiFunction<Flowable,org.reactivestreams.Subscriber,org.reactivestreams.Subscriber> onFlowableSubscribe)
Sets the specific hook function.
|
static void |
setOnMaybeAssembly(Function<Maybe,Maybe> onMaybeAssembly)
Sets the specific hook function.
|
static void |
setOnMaybeSubscribe(BiFunction<Maybe,MaybeObserver,MaybeObserver> onMaybeSubscribe)
Sets the specific hook function.
|
static void |
setOnObservableAssembly(Function<Observable,Observable> onObservableAssembly)
Sets the specific hook function.
|
static void |
setOnObservableSubscribe(BiFunction<Observable,Observer,Observer> onObservableSubscribe)
Sets the specific hook function.
|
static void |
setOnSingleAssembly(Function<Single,Single> onSingleAssembly)
Sets the specific hook function.
|
static void |
setOnSingleSubscribe(BiFunction<Single,SingleObserver,SingleObserver> onSingleSubscribe)
Sets the specific hook function.
|
static void |
setScheduleHandler(Function<java.lang.Runnable,java.lang.Runnable> handler)
Sets the specific hook function.
|
static void |
setSingleSchedulerHandler(Function<Scheduler,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 Function<Scheduler,Scheduler> getComputationSchedulerHandler()
public static Consumer<java.lang.Throwable> getErrorHandler()
public static Function<java.util.concurrent.Callable<Scheduler>,Scheduler> getInitComputationSchedulerHandler()
public static Function<java.util.concurrent.Callable<Scheduler>,Scheduler> getInitIoSchedulerHandler()
public static Function<java.util.concurrent.Callable<Scheduler>,Scheduler> getInitNewThreadSchedulerHandler()
public static Function<java.util.concurrent.Callable<Scheduler>,Scheduler> getInitSingleSchedulerHandler()
public static Function<Scheduler,Scheduler> getIoSchedulerHandler()
public static Function<Scheduler,Scheduler> getNewThreadSchedulerHandler()
public static Function<java.lang.Runnable,java.lang.Runnable> getScheduleHandler()
public static Function<Scheduler,Scheduler> getSingleSchedulerHandler()
public static Scheduler initComputationScheduler(java.util.concurrent.Callable<Scheduler> defaultScheduler)
defaultScheduler
- a Callable
which returns the hook's input valuejava.lang.NullPointerException
- if the callable parameter or its result are nullpublic static Scheduler initIoScheduler(java.util.concurrent.Callable<Scheduler> defaultScheduler)
defaultScheduler
- a Callable
which returns the hook's input valuejava.lang.NullPointerException
- if the callable parameter or its result are nullpublic static Scheduler initNewThreadScheduler(java.util.concurrent.Callable<Scheduler> defaultScheduler)
defaultScheduler
- a Callable
which returns the hook's input valuejava.lang.NullPointerException
- if the callable parameter or its result are nullpublic static Scheduler initSingleScheduler(java.util.concurrent.Callable<Scheduler> defaultScheduler)
defaultScheduler
- a Callable
which returns the hook's input valuejava.lang.NullPointerException
- if the callable parameter or its result are nullpublic static Scheduler onComputationScheduler(Scheduler defaultScheduler)
defaultScheduler
- the hook's input valuepublic static void onError(java.lang.Throwable error)
error
- the error to reportpublic static Scheduler onIoScheduler(Scheduler defaultScheduler)
defaultScheduler
- the hook's input valuepublic static Scheduler onNewThreadScheduler(Scheduler defaultScheduler)
defaultScheduler
- the hook's input valuepublic static java.lang.Runnable onSchedule(java.lang.Runnable run)
run
- the runnable instancepublic static Scheduler onSingleScheduler(Scheduler defaultScheduler)
defaultScheduler
- the hook's input valuepublic static void reset()
public static void setComputationSchedulerHandler(Function<Scheduler,Scheduler> handler)
handler
- the hook function to set, null allowedpublic static void setErrorHandler(Consumer<java.lang.Throwable> handler)
handler
- the hook function to set, null allowedpublic static void setInitComputationSchedulerHandler(Function<java.util.concurrent.Callable<Scheduler>,Scheduler> handler)
handler
- the hook function to set, null allowed, but the function may not return nullpublic static void setInitIoSchedulerHandler(Function<java.util.concurrent.Callable<Scheduler>,Scheduler> handler)
handler
- the hook function to set, null allowed, but the function may not return nullpublic static void setInitNewThreadSchedulerHandler(Function<java.util.concurrent.Callable<Scheduler>,Scheduler> handler)
handler
- the hook function to set, null allowed, but the function may not return nullpublic static void setInitSingleSchedulerHandler(Function<java.util.concurrent.Callable<Scheduler>,Scheduler> handler)
handler
- the hook function to set, null allowed, but the function may not return nullpublic static void setIoSchedulerHandler(Function<Scheduler,Scheduler> handler)
handler
- the hook function to set, null allowedpublic static void setNewThreadSchedulerHandler(Function<Scheduler,Scheduler> handler)
handler
- the hook function to set, null allowedpublic static void setScheduleHandler(Function<java.lang.Runnable,java.lang.Runnable> handler)
handler
- the hook function to set, null allowedpublic static void setSingleSchedulerHandler(Function<Scheduler,Scheduler> handler)
handler
- the hook function to set, null allowedpublic static Function<Completable,Completable> getOnCompletableAssembly()
public static BiFunction<Completable,CompletableObserver,CompletableObserver> getOnCompletableSubscribe()
public static Function<Flowable,Flowable> getOnFlowableAssembly()
public static Function<ConnectableFlowable,ConnectableFlowable> getOnConnectableFlowableAssembly()
public static BiFunction<Flowable,org.reactivestreams.Subscriber,org.reactivestreams.Subscriber> getOnFlowableSubscribe()
public static BiFunction<Maybe,MaybeObserver,MaybeObserver> getOnMaybeSubscribe()
public static Function<Maybe,Maybe> getOnMaybeAssembly()
public static Function<Single,Single> getOnSingleAssembly()
public static BiFunction<Single,SingleObserver,SingleObserver> getOnSingleSubscribe()
public static Function<Observable,Observable> getOnObservableAssembly()
public static Function<ConnectableObservable,ConnectableObservable> getOnConnectableObservableAssembly()
public static BiFunction<Observable,Observer,Observer> getOnObservableSubscribe()
public static void setOnCompletableAssembly(Function<Completable,Completable> onCompletableAssembly)
onCompletableAssembly
- the hook function to set, null allowedpublic static void setOnCompletableSubscribe(BiFunction<Completable,CompletableObserver,CompletableObserver> onCompletableSubscribe)
onCompletableSubscribe
- the hook function to set, null allowedpublic static void setOnFlowableAssembly(Function<Flowable,Flowable> onFlowableAssembly)
onFlowableAssembly
- the hook function to set, null allowedpublic static void setOnMaybeAssembly(Function<Maybe,Maybe> onMaybeAssembly)
onMaybeAssembly
- the hook function to set, null allowedpublic static void setOnConnectableFlowableAssembly(Function<ConnectableFlowable,ConnectableFlowable> onConnectableFlowableAssembly)
onConnectableFlowableAssembly
- the hook function to set, null allowedpublic static void setOnFlowableSubscribe(BiFunction<Flowable,org.reactivestreams.Subscriber,org.reactivestreams.Subscriber> onFlowableSubscribe)
onFlowableSubscribe
- the hook function to set, null allowedpublic static void setOnMaybeSubscribe(BiFunction<Maybe,MaybeObserver,MaybeObserver> onMaybeSubscribe)
onMaybeSubscribe
- the hook function to set, null allowedpublic static void setOnObservableAssembly(Function<Observable,Observable> onObservableAssembly)
onObservableAssembly
- the hook function to set, null allowedpublic static void setOnConnectableObservableAssembly(Function<ConnectableObservable,ConnectableObservable> onConnectableObservableAssembly)
onConnectableObservableAssembly
- the hook function to set, null allowedpublic static void setOnObservableSubscribe(BiFunction<Observable,Observer,Observer> onObservableSubscribe)
onObservableSubscribe
- the hook function to set, null allowedpublic static void setOnSingleAssembly(Function<Single,Single> onSingleAssembly)
onSingleAssembly
- the hook function to set, null allowedpublic static void setOnSingleSubscribe(BiFunction<Single,SingleObserver,SingleObserver> onSingleSubscribe)
onSingleSubscribe
- the hook function to set, null allowedpublic static <T> org.reactivestreams.Subscriber<? super T> onSubscribe(Flowable<T> source, org.reactivestreams.Subscriber<? super T> subscriber)
T
- the value typesource
- the hook's input valuesubscriber
- the subscriberpublic static <T> Observer<? super T> onSubscribe(Observable<T> source, Observer<? super T> observer)
T
- the value typesource
- the hook's input valueobserver
- the observerpublic static <T> SingleObserver<? super T> onSubscribe(Single<T> source, SingleObserver<? super T> observer)
T
- the value typesource
- the hook's input valueobserver
- the observerpublic static CompletableObserver onSubscribe(Completable source, CompletableObserver observer)
source
- the hook's input valueobserver
- the observerpublic static <T> MaybeObserver<? super T> onSubscribe(Maybe<T> source, MaybeObserver<? super T> subscriber)
T
- the value typesource
- the hook's input valuesubscriber
- the subscriberpublic static <T> Maybe<T> onAssembly(Maybe<T> source)
T
- the value typesource
- the hook's input valuepublic static <T> Flowable<T> onAssembly(Flowable<T> source)
T
- the value typesource
- the hook's input valuepublic static <T> ConnectableFlowable<T> onAssembly(ConnectableFlowable<T> source)
T
- the value typesource
- the hook's input valuepublic static <T> Observable<T> onAssembly(Observable<T> source)
T
- the value typesource
- the hook's input valuepublic static <T> ConnectableObservable<T> onAssembly(ConnectableObservable<T> source)
T
- the value typesource
- the hook's input valuepublic static <T> Single<T> onAssembly(Single<T> source)
T
- the value typesource
- the hook's input valuepublic static Completable onAssembly(Completable source)
source
- the hook's input value