Class RxJavaPlugins
- plugin registered globally via
registermethods in this class - plugin registered and retrieved using
System.getProperty(String)(see get methods for property names) - default implementation
In addition to the rxjava.plugin.[simple classname].implementation system properties,
you can define two system property:
rxjava.plugin.[index].class}
rxjava.plugin.[index].impl}
Where the .class property contains the simple classname from above and the .impl
contains the fully qualified name of the implementation class. The [index] can be
any short string or number of your choosing. For example, you can now define a custom
RxJavaErrorHandler via two system property:
rxjava.plugin.1.class=RxJavaErrorHandler
rxjava.plugin.1.impl=some.package.MyRxJavaErrorHandler
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicReference<RxJavaCompletableExecutionHook> (package private) static final RxJavaErrorHandlerprivate final AtomicReference<RxJavaErrorHandler> private static final RxJavaPluginsprivate final AtomicReference<RxJavaObservableExecutionHook> private final AtomicReference<RxJavaSchedulersHook> private final AtomicReference<RxJavaSingleExecutionHook> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the instance ofRxJavaCompletableExecutionHookto use based on order of precedence as defined inRxJavaPluginsclass header.Retrieves an instance ofRxJavaErrorHandlerto use based on order of precedence as defined inRxJavaPluginsclass header.static RxJavaPluginsDeprecated.Retrieves the instance ofRxJavaObservableExecutionHookto use based on order of precedence as defined inRxJavaPluginsclass header.(package private) static ObjectgetPluginImplementationViaProperty(Class<?> pluginClass, Properties propsIn) Retrieves the instance ofRxJavaSchedulersHookto use based on order of precedence as defined in theRxJavaPluginsclass header.Retrieves the instance ofRxJavaSingleExecutionHookto use based on order of precedence as defined inRxJavaPluginsclass header.voidRegister anRxJavaCompletableExecutionHookimplementation as a global override of any injected or default implementations.voidRegisters anRxJavaErrorHandlerimplementation as a global override of any injected or default implementations.voidRegister anRxJavaObservableExecutionHookimplementation as a global override of any injected or default implementations.voidRegisters anRxJavaSchedulersHookimplementation as a global override of any injected or default implementations.voidRegister anRxJavaSingleExecutionHookimplementation as a global override of any injected or default implementations.voidreset()ResetRxJavaPluginsinstance
-
Field Details
-
INSTANCE
-
errorHandler
-
observableExecutionHook
-
singleExecutionHook
-
completableExecutionHook
-
schedulersHook
-
DEFAULT_ERROR_HANDLER
-
-
Constructor Details
-
RxJavaPlugins
RxJavaPlugins()
-
-
Method Details
-
getInstance
Deprecated.use the static methods ofRxJavaHooks.Retrieves the singleRxJavaPluginsinstance.- Returns:
- the single
RxJavaPluginsinstance
-
reset
ResetRxJavaPluginsinstanceThis API is experimental. Resetting the plugins is dangerous during application runtime and also bad code could invoke it in the middle of an application life-cycle and really break applications if not used cautiously. For more detailed discussions: * @see Make RxJavaPlugins.reset() public
-
getErrorHandler
Retrieves an instance ofRxJavaErrorHandlerto use based on order of precedence as defined inRxJavaPluginsclass header.Override the default by calling
registerErrorHandler(RxJavaErrorHandler)or by setting the propertyrxjava.plugin.RxJavaErrorHandler.implementationwith the full classname to load.- Returns:
RxJavaErrorHandlerimplementation to use
-
registerErrorHandler
Registers anRxJavaErrorHandlerimplementation as a global override of any injected or default implementations.- Parameters:
impl-RxJavaErrorHandlerimplementation- Throws:
IllegalStateException- if called more than once or after the default was initialized (if usage occurs before trying to register)
-
getObservableExecutionHook
Retrieves the instance ofRxJavaObservableExecutionHookto use based on order of precedence as defined inRxJavaPluginsclass header.Override the default by calling
registerObservableExecutionHook(RxJavaObservableExecutionHook)or by setting the propertyrxjava.plugin.RxJavaObservableExecutionHook.implementationwith the full classname to load.- Returns:
RxJavaObservableExecutionHookimplementation to use
-
registerObservableExecutionHook
Register anRxJavaObservableExecutionHookimplementation as a global override of any injected or default implementations.- Parameters:
impl-RxJavaObservableExecutionHookimplementation- Throws:
IllegalStateException- if called more than once or after the default was initialized (if usage occurs before trying to register)
-
getSingleExecutionHook
Retrieves the instance ofRxJavaSingleExecutionHookto use based on order of precedence as defined inRxJavaPluginsclass header.Override the default by calling
registerSingleExecutionHook(RxJavaSingleExecutionHook)or by setting the propertyrxjava.plugin.RxJavaSingleExecutionHook.implementationwith the full classname to load.- Returns:
RxJavaSingleExecutionHookimplementation to use
-
registerSingleExecutionHook
Register anRxJavaSingleExecutionHookimplementation as a global override of any injected or default implementations.- Parameters:
impl-RxJavaSingleExecutionHookimplementation- Throws:
IllegalStateException- if called more than once or after the default was initialized (if usage occurs before trying to register)
-
getCompletableExecutionHook
Retrieves the instance ofRxJavaCompletableExecutionHookto use based on order of precedence as defined inRxJavaPluginsclass header.Override the default by calling
registerCompletableExecutionHook(RxJavaCompletableExecutionHook)or by setting the propertyrxjava.plugin.RxJavaCompletableExecutionHook.implementationwith the full classname to load.- Returns:
RxJavaCompletableExecutionHookimplementation to use- Since:
- (if this graduates from Experimental/Beta to supported, replace this parenthetical with the release number)
-
registerCompletableExecutionHook
Register anRxJavaCompletableExecutionHookimplementation as a global override of any injected or default implementations.- Parameters:
impl-RxJavaCompletableExecutionHookimplementation- Throws:
IllegalStateException- if called more than once or after the default was initialized (if usage occurs before trying to register)- Since:
- (if this graduates from Experimental/Beta to supported, replace this parenthetical with the release number)
-
getPluginImplementationViaProperty
-
getSchedulersHook
Retrieves the instance ofRxJavaSchedulersHookto use based on order of precedence as defined in theRxJavaPluginsclass header.Override the default by calling
registerSchedulersHook(RxJavaSchedulersHook)or by setting the propertyrxjava.plugin.RxJavaSchedulersHook.implementationwith the full classname to load.- Returns:
- the
RxJavaSchedulersHookimplementation in use
-
registerSchedulersHook
Registers anRxJavaSchedulersHookimplementation as a global override of any injected or default implementations.- Parameters:
impl-RxJavaSchedulersHookimplementation- Throws:
IllegalStateException- if called more than once or after the default was initialized (if usage occurs before trying to register)
-
RxJavaHooks.