Make RxJavaPlugins.reset() public
See original GitHub issueLet me preface this by saying the RxJava library has made my life easier in just the short time I’ve been using it. However, there’s one jagged edge that bit me today.
I’m attempting to use the RxJavaPlugins
class to override the default schedulers via registerSchedulersHook
. However, I want to only override the defaults for a single JUnit test. Ideally, I would call RxJavaPlugins.getInstance().reset()
in my @After
method…but I can’t, because it is package private.
I could get at it via reflection, but it’d be easier if it was public – unless there is a) a very good reason it is not or b) there is an obvious alternative I am missing (always a possibility!)
Issue Analytics
- State:
- Created 9 years ago
- Comments:18 (6 by maintainers)
Top Results From Across the Web
io.reactivex.plugins.RxJavaPlugins.reset java code examples
@Test public void invalidDeferredRequest() { AtomicReference<Subscription> atomicSubscription = new AtomicReference<Subscription>(); AtomicLong r = new ...
Read more >RxJavaPlugins (RxJava Javadoc 1.3.8) - ReactiveX
reset. public void reset(). Reset RxJavaPlugins instance. This API is experimental. Resetting the plugins is dangerous during application runtime and also ...
Read more >RxJavaPlugins (RxJava Javadoc 2.2.7)
public final class RxJavaPlugins extends Object ... Create an instance of the default Scheduler used for Schedulers.io() except ... static void, reset().
Read more >RxJava 2 overriding IO scheduler in unit test - Stack Overflow
setMainThreadSchedulerHandler { immediateScheduler } } override fun after() { RxJavaPlugins.reset() } }. You can find a way to migrate from ...
Read more >rx.plugins.RxJavaPlugins Maven / Gradle / Ivy
For more detailed discussions: * @see Make RxJavaPlugins.reset() public * @since 1.3 */ public void reset() { INSTANCE.errorHandler.set(null); INSTANCE.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi! @benjchristensen @akarnokd @mattrjacobs @abersnaze - any news on this? It doesn’t seem like a big change and would certainly be helpful in Spring Cloud Sleuth’s intergration with RxJava.
👍 I was trying to contribute back to
spring-cloud-sleuth
to have distributed tracing capabilities across RxJava threadpools as well (https://github.com/spring-cloud/spring-cloud-sleuth/issues/235). I am following their currentHystrix
implementation strategy : https://github.com/spring-cloud/spring-cloud-sleuth/blob/master/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/hystrix/SleuthHystrixConcurrencyStrategy.java#L66 You could reset HystrixPlugins but the same cannot be done right now with RxjavaPlugins. I have to create a wrapper (as mentioned above) in the samerx.plugins
folder as a workaround (testing as we speak if it’s working or not). It’d be good to not have to do this workaround.