These are chat archives for ReactiveX/RxJava

13th
Jun 2016
dangxunb
@dangxunb
Jun 13 2016 06:41

I have the following code snippet:
(I'm sorry, the markdown failed to render full code block, so I upload it to gist)
https://gist.github.com/dangxunb/29d6c295ad776e5872194fb8811502ab

If I subscribe to BehaviorSubject itself, (obs.subscribe(..) instead of create a ConnectableObservable), the program's output will be:

Thread-0----0
Thread-0----1
Thread-0----2
Thread-0----3
Thread-0----4
Thread-0----5

but if I run the above code snippet, it will output:

main----0
Thread-0----1
Thread-0----2
Thread-0----3
Thread-0----4

I don't understand why main thread can emit the first item?

Darius Lapūnas
@DariusL
Jun 13 2016 16:50
Hi, I've been having trouble with RxJavaObservableExecutionHook. Specifically, I tried setting a hook for logging in a JUnit rule, and unsetting it after the test. But Same hook gets used regardless.
Wrote a small test to illustrate the problem
https://gist.github.com/DariusL/95f4ea9d0a1ae69dd398a87b3ae00051
The test fails on the second assert

static final RxJavaObservableExecutionHook hook = RxJavaPlugins.getInstance().getObservableExecutionHook();

apparently, Observable cached the hook

How can reset work with this?
Artem Zinnatullin :slowpoke:
@artem-zinnatullin
Jun 13 2016 22:53
@DariusL sounds like a bug, can you please check it again and open an issue in RxJava GitHub repo with test (better in Java)?