Class RxJavaPlugins
-
Method Summary
Modifier and TypeMethodDescriptioncreateComputationScheduler(@NonNull ThreadFactory threadFactory) Create an instance of the defaultSchedulerused forSchedulers.computation()except usingthreadFactoryfor thread creation.createExecutorScheduler(@NonNull Executor executor, boolean interruptibleWorker, boolean fair) createIoScheduler(@NonNull ThreadFactory threadFactory) Create an instance of the defaultSchedulerused forSchedulers.io()except usingthreadFactoryfor thread creation.createNewThreadScheduler(@NonNull ThreadFactory threadFactory) Create an instance of the defaultSchedulerused forSchedulers.newThread()except usingthreadFactoryfor thread creation.createSingleScheduler(@NonNull ThreadFactory threadFactory) Create an instance of the defaultSchedulerused forSchedulers.single()except usingthreadFactoryfor thread creation.Returns the current hook function.Returns the a hook consumer.Returns the current hook function.Returns the current hook function.Returns the current hook function.Returns the current hook function.Returns the current hook function.Returns the current hook function.static @Nullable BooleanSupplierReturns the current blocking handler or null if no custom handler is set.static @Nullable Function<? super Completable, ? extends Completable> Returns the current hook function.static @Nullable BiFunction<? super Completable, @NonNull ? super CompletableObserver, @NonNull ? extends CompletableObserver> Returns the current hook function.static @Nullable Function<? super ConnectableFlowable, ? extends ConnectableFlowable> Returns the current hook function.static @Nullable Function<? super ConnectableObservable, ? extends ConnectableObservable> Returns the current hook function.Returns the current hook function.static @Nullable BiFunction<? super Flowable, @NonNull ? super Flow.Subscriber, @NonNull ? extends Flow.Subscriber> Returns the current hook function.Returns the current hook function.static @Nullable BiFunction<? super Maybe, @NonNull ? super MaybeObserver, @NonNull ? extends MaybeObserver> Returns the current hook function.static @Nullable Function<? super Observable, ? extends Observable> Returns the current hook function.static @Nullable BiFunction<? super Observable, @NonNull ? super Observer, @NonNull ? extends Observer> Returns the current hook function.static @Nullable Function<? super ParallelFlowable, ? extends ParallelFlowable> Returns the current hook function.static @Nullable BiFunction<? super ParallelFlowable, @NonNull ? super Flow.Subscriber[], @NonNull ? extends Flow.Subscriber[]> Returns the current hook function.Returns the current hook function.static @Nullable BiFunction<? super Single, @NonNull ? super SingleObserver, @NonNull ? extends SingleObserver> Returns the current hook function.Returns the current hook function.Returns the current hook function.initComputationScheduler(@NonNull Supplier<Scheduler> defaultScheduler) Calls the associated hook function.initIoScheduler(@NonNull Supplier<Scheduler> defaultScheduler) Calls the associated hook function.initNewThreadScheduler(@NonNull Supplier<Scheduler> defaultScheduler) Calls the associated hook function.initSingleScheduler(@NonNull Supplier<Scheduler> defaultScheduler) Calls the associated hook function.static booleanReturns true if the blockingX operators fail with an IllegalStateException on a non-blocking scheduler such as computation or single.static booleanReturns true if the plugins were locked down.static voidlockdown()Prevents changing the plugins from then on.static @NonNull CompletableonAssembly(@NonNull Completable source) Calls the associated hook function.onAssembly(@NonNull Flowable<@NonNull T> source) Calls the associated hook function.onAssembly(@NonNull Maybe<@NonNull T> source) Calls the associated hook function.static <@NonNull T>
@NonNull Observable<T> onAssembly(@NonNull Observable<@NonNull T> source) Calls the associated hook function.onAssembly(@NonNull Single<@NonNull T> source) Calls the associated hook function.static <@NonNull T>
@NonNull ConnectableFlowable<T> onAssembly(@NonNull ConnectableFlowable<@NonNull T> source) Calls the associated hook function.static <@NonNull T>
@NonNull ConnectableObservable<T> onAssembly(@NonNull ConnectableObservable<@NonNull T> source) Calls the associated hook function.static <@NonNull T>
@NonNull ParallelFlowable<T> onAssembly(@NonNull ParallelFlowable<@NonNull T> source) Calls the associated hook function.static booleanCalled 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.onComputationScheduler(@NonNull Scheduler defaultScheduler) Calls the associated hook function.static voidCalled when an undeliverable error occurs.onIoScheduler(@NonNull Scheduler defaultScheduler) Calls the associated hook function.onNewThreadScheduler(@NonNull Scheduler defaultScheduler) Calls the associated hook function.onSchedule(@NonNull Runnable run) Called when a task is scheduled.onSingleScheduler(@NonNull Scheduler defaultScheduler) Calls the associated hook function.static @NonNull CompletableObserveronSubscribe(@NonNull Completable source, @NonNull CompletableObserver observer) Calls the associated hook function.static <@NonNull T>
@NonNull Flow.Subscriber<? super T> onSubscribe(@NonNull Flowable<@NonNull T> source, @NonNull Flow.Subscriber<? super @NonNull T> subscriber) Calls the associated hook function.static <@NonNull T>
@NonNull MaybeObserver<? super T> onSubscribe(@NonNull Maybe<@NonNull T> source, @NonNull MaybeObserver<? super @NonNull T> observer) Calls the associated hook function.onSubscribe(@NonNull Observable<@NonNull T> source, @NonNull Observer<? super @NonNull T> observer) Calls the associated hook function.static <@NonNull T>
@NonNull SingleObserver<? super T> onSubscribe(@NonNull Single<@NonNull T> source, @NonNull SingleObserver<? super @NonNull T> observer) Calls the associated hook function.static <@NonNull T>
@NonNull Flow.Subscriber<? super T>[]onSubscribe(@NonNull ParallelFlowable<@NonNull T> source, @NonNull Flow.Subscriber<? super @NonNull T>[] subscribers) Calls the associated hook function.static voidreset()Removes all handlers and resets to default behavior.static voidsetComputationSchedulerHandler(@Nullable Function<? super Scheduler, ? extends Scheduler> handler) Sets the specific hook function.static voidsetErrorHandler(@Nullable Consumer<? super Throwable> handler) Sets the specific hook function.static voidsetFailOnNonBlockingScheduler(boolean enable) Enables or disables the blockingX operators to fail with an IllegalStateException on a non-blocking scheduler such as computation or single.static voidsetInitComputationSchedulerHandler(@Nullable Function<? super Supplier<Scheduler>, ? extends Scheduler> handler) Sets the specific hook function.static voidsetInitIoSchedulerHandler(@Nullable Function<? super Supplier<Scheduler>, ? extends Scheduler> handler) Sets the specific hook function.static voidsetInitNewThreadSchedulerHandler(@Nullable Function<? super Supplier<Scheduler>, ? extends Scheduler> handler) Sets the specific hook function.static voidsetInitSingleSchedulerHandler(@Nullable Function<? super Supplier<Scheduler>, ? extends Scheduler> handler) Sets the specific hook function.static voidsetIoSchedulerHandler(@Nullable Function<? super Scheduler, ? extends Scheduler> handler) Sets the specific hook function.static voidsetNewThreadSchedulerHandler(@Nullable Function<? super Scheduler, ? extends Scheduler> handler) Sets the specific hook function.static voidsetOnBeforeBlocking(@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 voidsetOnCompletableAssembly(@Nullable Function<? super Completable, ? extends Completable> onCompletableAssembly) Sets the specific hook function.static voidsetOnCompletableSubscribe(@Nullable BiFunction<? super Completable, @NonNull ? super CompletableObserver, @NonNull ? extends CompletableObserver> onCompletableSubscribe) Sets the specific hook function.static voidsetOnConnectableFlowableAssembly(@Nullable Function<? super ConnectableFlowable, ? extends ConnectableFlowable> onConnectableFlowableAssembly) Sets the specific hook function.static voidsetOnConnectableObservableAssembly(@Nullable Function<? super ConnectableObservable, ? extends ConnectableObservable> onConnectableObservableAssembly) Sets the specific hook function.static voidsetOnFlowableAssembly(@Nullable Function<? super Flowable, ? extends Flowable> onFlowableAssembly) Sets the specific hook function.static voidsetOnFlowableSubscribe(@Nullable BiFunction<? super Flowable, @NonNull ? super Flow.Subscriber, @NonNull ? extends Flow.Subscriber> onFlowableSubscribe) Sets the specific hook function.static voidsetOnMaybeAssembly(@Nullable Function<? super Maybe, ? extends Maybe> onMaybeAssembly) Sets the specific hook function.static voidsetOnMaybeSubscribe(@Nullable BiFunction<? super Maybe, @NonNull MaybeObserver, @NonNull ? extends MaybeObserver> onMaybeSubscribe) Sets the specific hook function.static voidsetOnObservableAssembly(@Nullable Function<? super Observable, ? extends Observable> onObservableAssembly) Sets the specific hook function.static voidsetOnObservableSubscribe(@Nullable BiFunction<? super Observable, @NonNull ? super Observer, @NonNull ? extends Observer> onObservableSubscribe) Sets the specific hook function.static voidsetOnParallelAssembly(@Nullable Function<? super ParallelFlowable, ? extends ParallelFlowable> handler) Sets the specific hook function.static voidsetOnParallelSubscribe(@Nullable BiFunction<? super ParallelFlowable, @NonNull ? super Flow.Subscriber[], @NonNull ? extends Flow.Subscriber[]> handler) Sets the specific hook function.static voidsetOnSingleAssembly(@Nullable Function<? super Single, ? extends Single> onSingleAssembly) Sets the specific hook function.static voidsetOnSingleSubscribe(@Nullable BiFunction<? super Single, @NonNull ? super SingleObserver, @NonNull ? extends SingleObserver> onSingleSubscribe) Sets the specific hook function.static voidsetScheduleHandler(@Nullable Function<? super Runnable, ? extends Runnable> handler) Sets the specific hook function.static voidsetSingleSchedulerHandler(@Nullable Function<? super Scheduler, ? extends Scheduler> handler) Sets the specific hook function.
-
Method Details
-
lockdown
public static void lockdown()Prevents changing the plugins from then on.This allows container-like environments to prevent clients messing with plugins.
-
isLockdown
public static boolean isLockdown()Returns true if the plugins were locked down.- Returns:
- true if the plugins were locked down
-
setFailOnNonBlockingScheduler
public 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.History: 2.0.5 - experimental
- Parameters:
enable- enable or disable the feature- Since:
- 2.1
-
isFailOnNonBlockingScheduler
public static boolean isFailOnNonBlockingScheduler()Returns true if the blockingX operators fail with an IllegalStateException on a non-blocking scheduler such as computation or single.History: 2.0.5 - experimental
- Returns:
- true if the blockingX operators fail on a non-blocking scheduler
- Since:
- 2.1
-
getComputationSchedulerHandler
-
getErrorHandler
-
getInitComputationSchedulerHandler
-
getInitIoSchedulerHandler
-
getInitNewThreadSchedulerHandler
-
getInitSingleSchedulerHandler
-
getIoSchedulerHandler
-
getNewThreadSchedulerHandler
-
getScheduleHandler
-
getSingleSchedulerHandler
-
initComputationScheduler
@NonNull public static @NonNull Scheduler initComputationScheduler(@NonNull @NonNull Supplier<Scheduler> defaultScheduler) Calls the associated hook function.- Parameters:
defaultScheduler- aSupplierwhich returns the hook's input value- Returns:
- the value returned by the hook, not null
- Throws:
NullPointerException- if the supplier parameter or its result are null
-
initIoScheduler
@NonNull public static @NonNull Scheduler initIoScheduler(@NonNull @NonNull Supplier<Scheduler> defaultScheduler) Calls the associated hook function.- Parameters:
defaultScheduler- aSupplierwhich returns the hook's input value- Returns:
- the value returned by the hook, not null
- Throws:
NullPointerException- if the supplier parameter or its result are null
-
initNewThreadScheduler
@NonNull public static @NonNull Scheduler initNewThreadScheduler(@NonNull @NonNull Supplier<Scheduler> defaultScheduler) Calls the associated hook function.- Parameters:
defaultScheduler- aSupplierwhich returns the hook's input value- Returns:
- the value returned by the hook, not null
- Throws:
NullPointerException- if the supplier parameter or its result are null
-
initSingleScheduler
@NonNull public static @NonNull Scheduler initSingleScheduler(@NonNull @NonNull Supplier<Scheduler> defaultScheduler) Calls the associated hook function.- Parameters:
defaultScheduler- aSupplierwhich returns the hook's input value- Returns:
- the value returned by the hook, not null
- Throws:
NullPointerException- if the supplier parameter or its result are null
-
onComputationScheduler
-
onError
Called when an undeliverable error occurs.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 itsDisposable/Subscriptionor has already terminated with anonError()oronComplete()signal.By default, this global error handler prints the stacktrace via
Throwable.printStackTrace()and callsThread.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.- Parameters:
error- the error to report- See Also:
-
onIoScheduler
-
onNewThreadScheduler
-
onSchedule
-
onSingleScheduler
-
reset
public static void reset()Removes all handlers and resets to default behavior. -
setComputationSchedulerHandler
-
setErrorHandler
-
setInitComputationSchedulerHandler
-
setInitIoSchedulerHandler
-
setInitNewThreadSchedulerHandler
-
setInitSingleSchedulerHandler
-
setIoSchedulerHandler
-
setNewThreadSchedulerHandler
-
setScheduleHandler
-
setSingleSchedulerHandler
-
getOnCompletableAssembly
@Nullable public static @Nullable Function<? super Completable, ? extends Completable> getOnCompletableAssembly()Returns the current hook function.- Returns:
- the hook function, may be null
-
getOnCompletableSubscribe
@Nullable public static @Nullable BiFunction<? super Completable, @NonNull ? super CompletableObserver, @NonNull ? extends CompletableObserver> getOnCompletableSubscribe()Returns the current hook function.- Returns:
- the hook function, may be null
-
getOnFlowableAssembly
-
getOnConnectableFlowableAssembly
@Nullable public static @Nullable Function<? super ConnectableFlowable, ? extends ConnectableFlowable> getOnConnectableFlowableAssembly()Returns the current hook function.- Returns:
- the hook function, may be null
-
getOnFlowableSubscribe
@Nullable public static @Nullable BiFunction<? super Flowable, @NonNull ? super Flow.Subscriber, @NonNull ? extends Flow.Subscriber> getOnFlowableSubscribe()Returns the current hook function.- Returns:
- the hook function, may be null
-
getOnMaybeSubscribe
@Nullable public static @Nullable BiFunction<? super Maybe, @NonNull ? super MaybeObserver, @NonNull ? extends MaybeObserver> getOnMaybeSubscribe()Returns the current hook function.- Returns:
- the hook function, may be null
-
getOnMaybeAssembly
-
getOnSingleAssembly
-
getOnSingleSubscribe
@Nullable public static @Nullable BiFunction<? super Single, @NonNull ? super SingleObserver, @NonNull ? extends SingleObserver> getOnSingleSubscribe()Returns the current hook function.- Returns:
- the hook function, may be null
-
getOnObservableAssembly
@Nullable public static @Nullable Function<? super Observable, ? extends Observable> getOnObservableAssembly()Returns the current hook function.- Returns:
- the hook function, may be null
-
getOnConnectableObservableAssembly
@Nullable public static @Nullable Function<? super ConnectableObservable, ? extends ConnectableObservable> getOnConnectableObservableAssembly()Returns the current hook function.- Returns:
- the hook function, may be null
-
getOnObservableSubscribe
@Nullable public static @Nullable BiFunction<? super Observable, @NonNull ? super Observer, @NonNull ? extends Observer> getOnObservableSubscribe()Returns the current hook function.- Returns:
- the hook function, may be null
-
setOnCompletableAssembly
public static void setOnCompletableAssembly(@Nullable @Nullable Function<? super Completable, ? extends Completable> onCompletableAssembly) Sets the specific hook function.- Parameters:
onCompletableAssembly- the hook function to set, null allowed
-
setOnCompletableSubscribe
public static void setOnCompletableSubscribe(@Nullable @Nullable BiFunction<? super Completable, @NonNull ? super CompletableObserver, @NonNull ? extends CompletableObserver> onCompletableSubscribe) Sets the specific hook function.- Parameters:
onCompletableSubscribe- the hook function to set, null allowed
-
setOnFlowableAssembly
-
setOnMaybeAssembly
-
setOnConnectableFlowableAssembly
public static void setOnConnectableFlowableAssembly(@Nullable @Nullable Function<? super ConnectableFlowable, ? extends ConnectableFlowable> onConnectableFlowableAssembly) Sets the specific hook function.- Parameters:
onConnectableFlowableAssembly- the hook function to set, null allowed
-
setOnFlowableSubscribe
public static void setOnFlowableSubscribe(@Nullable @Nullable BiFunction<? super Flowable, @NonNull ? super Flow.Subscriber, @NonNull ? extends Flow.Subscriber> onFlowableSubscribe) Sets the specific hook function.- Parameters:
onFlowableSubscribe- the hook function to set, null allowed
-
setOnMaybeSubscribe
public static void setOnMaybeSubscribe(@Nullable @Nullable BiFunction<? super Maybe, @NonNull MaybeObserver, @NonNull ? extends MaybeObserver> onMaybeSubscribe) Sets the specific hook function.- Parameters:
onMaybeSubscribe- the hook function to set, null allowed
-
setOnObservableAssembly
public static void setOnObservableAssembly(@Nullable @Nullable Function<? super Observable, ? extends Observable> onObservableAssembly) Sets the specific hook function.- Parameters:
onObservableAssembly- the hook function to set, null allowed
-
setOnConnectableObservableAssembly
public static void setOnConnectableObservableAssembly(@Nullable @Nullable Function<? super ConnectableObservable, ? extends ConnectableObservable> onConnectableObservableAssembly) Sets the specific hook function.- Parameters:
onConnectableObservableAssembly- the hook function to set, null allowed
-
setOnObservableSubscribe
public static void setOnObservableSubscribe(@Nullable @Nullable BiFunction<? super Observable, @NonNull ? super Observer, @NonNull ? extends Observer> onObservableSubscribe) Sets the specific hook function.- Parameters:
onObservableSubscribe- the hook function to set, null allowed
-
setOnSingleAssembly
-
setOnSingleSubscribe
public static void setOnSingleSubscribe(@Nullable @Nullable BiFunction<? super Single, @NonNull ? super SingleObserver, @NonNull ? extends SingleObserver> onSingleSubscribe) Sets the specific hook function.- Parameters:
onSingleSubscribe- the hook function to set, null allowed
-
onSubscribe
@NonNull public static <@NonNull T> @NonNull Flow.Subscriber<? super T> onSubscribe(@NonNull @NonNull Flowable<@NonNull T> source, @NonNull @NonNull Flow.Subscriber<? super @NonNull T> subscriber) Calls the associated hook function.- Type Parameters:
T- the value type- Parameters:
source- the hook's input valuesubscriber- the subscriber- Returns:
- the value returned by the hook
-
onSubscribe
@NonNull public static <@NonNull T> @NonNull Observer<? super T> onSubscribe(@NonNull @NonNull Observable<@NonNull T> source, @NonNull @NonNull Observer<? super @NonNull T> observer) Calls the associated hook function.- Type Parameters:
T- the value type- Parameters:
source- the hook's input valueobserver- the observer- Returns:
- the value returned by the hook
-
onSubscribe
@NonNull public static <@NonNull T> @NonNull SingleObserver<? super T> onSubscribe(@NonNull @NonNull Single<@NonNull T> source, @NonNull @NonNull SingleObserver<? super @NonNull T> observer) Calls the associated hook function.- Type Parameters:
T- the value type- Parameters:
source- the hook's input valueobserver- the observer- Returns:
- the value returned by the hook
-
onSubscribe
@NonNull public static @NonNull CompletableObserver onSubscribe(@NonNull @NonNull Completable source, @NonNull @NonNull CompletableObserver observer) Calls the associated hook function.- Parameters:
source- the hook's input valueobserver- the observer- Returns:
- the value returned by the hook
-
onSubscribe
@NonNull public static <@NonNull T> @NonNull MaybeObserver<? super T> onSubscribe(@NonNull @NonNull Maybe<@NonNull T> source, @NonNull @NonNull MaybeObserver<? super @NonNull T> observer) Calls the associated hook function.- Type Parameters:
T- the value type- Parameters:
source- the hook's input valueobserver- the subscriber- Returns:
- the value returned by the hook
-
onSubscribe
@NonNull public static <@NonNull T> @NonNull Flow.Subscriber<? super T>[] onSubscribe(@NonNull @NonNull ParallelFlowable<@NonNull T> source, @NonNull @NonNull Flow.Subscriber<? super @NonNull T>[] subscribers) Calls the associated hook function.- Type Parameters:
T- the value type- Parameters:
source- the hook's input valuesubscribers- the array of subscribers- Returns:
- the value returned by the hook
-
onAssembly
-
onAssembly
-
onAssembly
@NonNull public static <@NonNull T> @NonNull ConnectableFlowable<T> onAssembly(@NonNull @NonNull ConnectableFlowable<@NonNull T> source) Calls the associated hook function.- Type Parameters:
T- the value type- Parameters:
source- the hook's input value- Returns:
- the value returned by the hook
-
onAssembly
@NonNull public static <@NonNull T> @NonNull Observable<T> onAssembly(@NonNull @NonNull Observable<@NonNull T> source) Calls the associated hook function.- Type Parameters:
T- the value type- Parameters:
source- the hook's input value- Returns:
- the value returned by the hook
-
onAssembly
@NonNull public static <@NonNull T> @NonNull ConnectableObservable<T> onAssembly(@NonNull @NonNull ConnectableObservable<@NonNull T> source) Calls the associated hook function.- Type Parameters:
T- the value type- Parameters:
source- the hook's input value- Returns:
- the value returned by the hook
-
onAssembly
-
onAssembly
Calls the associated hook function.- Parameters:
source- the hook's input value- Returns:
- the value returned by the hook
-
setOnParallelAssembly
public static void setOnParallelAssembly(@Nullable @Nullable Function<? super ParallelFlowable, ? extends ParallelFlowable> handler) Sets the specific hook function.History: 2.0.6 - experimental; 2.1 - beta
- Parameters:
handler- the hook function to set, null allowed- Since:
- 2.2
-
getOnParallelAssembly
@Nullable public static @Nullable Function<? super ParallelFlowable, ? extends ParallelFlowable> getOnParallelAssembly()Returns the current hook function.History: 2.0.6 - experimental; 2.1 - beta
- Returns:
- the hook function, may be null
- Since:
- 2.2
-
setOnParallelSubscribe
public static void setOnParallelSubscribe(@Nullable @Nullable BiFunction<? super ParallelFlowable, @NonNull ? super Flow.Subscriber[], @NonNull ? extends Flow.Subscriber[]> handler) Sets the specific hook function.History: 3.0.11 - experimental
- Parameters:
handler- the hook function to set, null allowed- Since:
- 3.1.0
-
getOnParallelSubscribe
@Nullable public static @Nullable BiFunction<? super ParallelFlowable, @NonNull ? super Flow.Subscriber[], @NonNull ? extends Flow.Subscriber[]> getOnParallelSubscribe()Returns the current hook function.History: 3.0.11 - experimental
- Returns:
- the hook function, may be null
- Since:
- 3.1.0
-
onAssembly
@NonNull public static <@NonNull T> @NonNull ParallelFlowable<T> onAssembly(@NonNull @NonNull ParallelFlowable<@NonNull T> source) Calls the associated hook function.History: 2.0.6 - experimental; 2.1 - beta
- Type Parameters:
T- the value type of the source- Parameters:
source- the hook's input value- Returns:
- the value returned by the hook
- Since:
- 2.2
-
onBeforeBlocking
public 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.History: 2.0.5 - experimental
- Returns:
- true if the blocking should be prevented
- Since:
- 2.1
- See Also:
-
setOnBeforeBlocking
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.History: 2.0.5 - experimental
- Parameters:
handler- the handler to set, null resets to the default handler that always returns false- Since:
- 2.1
- See Also:
-
getOnBeforeBlocking
Returns the current blocking handler or null if no custom handler is set.History: 2.0.5 - experimental
- Returns:
- the current blocking handler or null if not specified
- Since:
- 2.1
-
createComputationScheduler
@NonNull public static @NonNull Scheduler createComputationScheduler(@NonNull @NonNull ThreadFactory threadFactory) Create an instance of the defaultSchedulerused forSchedulers.computation()except usingthreadFactoryfor thread creation.History: 2.0.5 - experimental
- Parameters:
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.- Returns:
- the created Scheduler instance
- Since:
- 2.1
-
createIoScheduler
@NonNull public static @NonNull Scheduler createIoScheduler(@NonNull @NonNull ThreadFactory threadFactory) Create an instance of the defaultSchedulerused forSchedulers.io()except usingthreadFactoryfor thread creation.History: 2.0.5 - experimental
- Parameters:
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.- Returns:
- the created Scheduler instance
- Since:
- 2.1
-
createNewThreadScheduler
@NonNull public static @NonNull Scheduler createNewThreadScheduler(@NonNull @NonNull ThreadFactory threadFactory) Create an instance of the defaultSchedulerused forSchedulers.newThread()except usingthreadFactoryfor thread creation.History: 2.0.5 - experimental
- Parameters:
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.- Returns:
- the created Scheduler instance
- Since:
- 2.1
-
createSingleScheduler
@NonNull public static @NonNull Scheduler createSingleScheduler(@NonNull @NonNull ThreadFactory threadFactory) Create an instance of the defaultSchedulerused forSchedulers.single()except usingthreadFactoryfor thread creation.History: 2.0.5 - experimental
- Parameters:
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.- Returns:
- the created Scheduler instance
- Since:
- 2.1
-
createExecutorScheduler
@NonNull public static @NonNull Scheduler createExecutorScheduler(@NonNull @NonNull Executor executor, boolean interruptibleWorker, boolean fair) Create an instance of aSchedulerby wrapping an existingExecutor.This method allows creating an
Executor-backedSchedulerbefore theSchedulersclass would initialize the standardSchedulers.- Parameters:
executor- theExecutorto wrap and turn into aScheduler.interruptibleWorker- iftrue, the tasks submitted to theScheduler.Workerwill be interrupted when the task is disposed.fair- iftrue, tasks submitted to theSchedulerorWorkerwill be executed by the underlyingExecutorone after the other, still in a FIFO and non-overlapping manner, but allows interleaving with other tasks submitted to the underlyingExecutor. Iffalse, the underlying FIFO scheme will execute as many tasks as it can before giving up the underlyingExecutorthread.- Returns:
- the new
Schedulerwrapping theExecutor - Since:
- 3.1.0
-