Class RxJavaPlugins
- plugin registered globally via
register
methods 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 RxJavaErrorHandler
private final AtomicReference
<RxJavaErrorHandler> private static final RxJavaPlugins
private final AtomicReference
<RxJavaObservableExecutionHook> private final AtomicReference
<RxJavaSchedulersHook> private final AtomicReference
<RxJavaSingleExecutionHook> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the instance ofRxJavaCompletableExecutionHook
to use based on order of precedence as defined inRxJavaPlugins
class header.Retrieves an instance ofRxJavaErrorHandler
to use based on order of precedence as defined inRxJavaPlugins
class header.static RxJavaPlugins
Deprecated.Retrieves the instance ofRxJavaObservableExecutionHook
to use based on order of precedence as defined inRxJavaPlugins
class header.(package private) static Object
getPluginImplementationViaProperty
(Class<?> pluginClass, Properties propsIn) Retrieves the instance ofRxJavaSchedulersHook
to use based on order of precedence as defined in theRxJavaPlugins
class header.Retrieves the instance ofRxJavaSingleExecutionHook
to use based on order of precedence as defined inRxJavaPlugins
class header.void
Register anRxJavaCompletableExecutionHook
implementation as a global override of any injected or default implementations.void
Registers anRxJavaErrorHandler
implementation as a global override of any injected or default implementations.void
Register anRxJavaObservableExecutionHook
implementation as a global override of any injected or default implementations.void
Registers anRxJavaSchedulersHook
implementation as a global override of any injected or default implementations.void
Register anRxJavaSingleExecutionHook
implementation as a global override of any injected or default implementations.void
reset()
ResetRxJavaPlugins
instance
-
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 singleRxJavaPlugins
instance.- Returns:
- the single
RxJavaPlugins
instance
-
reset
ResetRxJavaPlugins
instanceThis 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 ofRxJavaErrorHandler
to use based on order of precedence as defined inRxJavaPlugins
class header.Override the default by calling
registerErrorHandler(RxJavaErrorHandler)
or by setting the propertyrxjava.plugin.RxJavaErrorHandler.implementation
with the full classname to load.- Returns:
RxJavaErrorHandler
implementation to use
-
registerErrorHandler
Registers anRxJavaErrorHandler
implementation as a global override of any injected or default implementations.- Parameters:
impl
-RxJavaErrorHandler
implementation- Throws:
IllegalStateException
- if called more than once or after the default was initialized (if usage occurs before trying to register)
-
getObservableExecutionHook
Retrieves the instance ofRxJavaObservableExecutionHook
to use based on order of precedence as defined inRxJavaPlugins
class header.Override the default by calling
registerObservableExecutionHook(RxJavaObservableExecutionHook)
or by setting the propertyrxjava.plugin.RxJavaObservableExecutionHook.implementation
with the full classname to load.- Returns:
RxJavaObservableExecutionHook
implementation to use
-
registerObservableExecutionHook
Register anRxJavaObservableExecutionHook
implementation as a global override of any injected or default implementations.- Parameters:
impl
-RxJavaObservableExecutionHook
implementation- Throws:
IllegalStateException
- if called more than once or after the default was initialized (if usage occurs before trying to register)
-
getSingleExecutionHook
Retrieves the instance ofRxJavaSingleExecutionHook
to use based on order of precedence as defined inRxJavaPlugins
class header.Override the default by calling
registerSingleExecutionHook(RxJavaSingleExecutionHook)
or by setting the propertyrxjava.plugin.RxJavaSingleExecutionHook.implementation
with the full classname to load.- Returns:
RxJavaSingleExecutionHook
implementation to use
-
registerSingleExecutionHook
Register anRxJavaSingleExecutionHook
implementation as a global override of any injected or default implementations.- Parameters:
impl
-RxJavaSingleExecutionHook
implementation- Throws:
IllegalStateException
- if called more than once or after the default was initialized (if usage occurs before trying to register)
-
getCompletableExecutionHook
Retrieves the instance ofRxJavaCompletableExecutionHook
to use based on order of precedence as defined inRxJavaPlugins
class header.Override the default by calling
registerCompletableExecutionHook(RxJavaCompletableExecutionHook)
or by setting the propertyrxjava.plugin.RxJavaCompletableExecutionHook.implementation
with the full classname to load.- Returns:
RxJavaCompletableExecutionHook
implementation to use- Since:
- (if this graduates from Experimental/Beta to supported, replace this parenthetical with the release number)
-
registerCompletableExecutionHook
Register anRxJavaCompletableExecutionHook
implementation as a global override of any injected or default implementations.- Parameters:
impl
-RxJavaCompletableExecutionHook
implementation- 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 ofRxJavaSchedulersHook
to use based on order of precedence as defined in theRxJavaPlugins
class header.Override the default by calling
registerSchedulersHook(RxJavaSchedulersHook)
or by setting the propertyrxjava.plugin.RxJavaSchedulersHook.implementation
with the full classname to load.- Returns:
- the
RxJavaSchedulersHook
implementation in use
-
registerSchedulersHook
Registers anRxJavaSchedulersHook
implementation as a global override of any injected or default implementations.- Parameters:
impl
-RxJavaSchedulersHook
implementation- Throws:
IllegalStateException
- if called more than once or after the default was initialized (if usage occurs before trying to register)
-
RxJavaHooks
.