question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make RxJavaPlugins.reset() public

See original GitHub issue

Let 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:closed
  • Created 9 years ago
  • Comments:18 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
marcingrzejszczakcommented, Apr 1, 2016

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.

1reaction
shivangshahcommented, Mar 31, 2016

👍 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 current Hystrix 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 same rx.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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found