These are chat archives for ReactiveX/RxJava

21st
Jul 2015
Denis Stepanov
@dstepanov
Jul 21 2015 15:36
Hi, how can I map the exception of Observable but result keep the same?
Artem Zinnatullin :slowpoke:
@artem-zinnatullin
Jul 21 2015 16:06
@dstepanov can you please provide more info, you got Observable that emits some kind of items and you in case of exception you want to do what?
David Stemmer
@weefbellington
Jul 21 2015 17:20
hello! I have an RxJava specific query on the topic of Observable.Operators
I have an Operator that needs to do some work in the background. Specifically, it needs to talk to a system service (the Android DrmManagerClient), set a listener on that service, wait for the service to do some work, and emit the output of that work
David Stemmer
@weefbellington
Jul 21 2015 17:28
for the most part this is pretty straightforward -- the Operator returns a Subscriberthat sets up the listener in the onNext method. When the listener callback fires, it calls onNext on the subscriber that handles the output
however, in this case the callback fires on a thread that is different than the original subscribeOnthread -- it's being handled inside a DrmManagerClient event handler thread
so my question is: what is the right thing to do in this case? Should I return control to the thread created by the original subscribeOn scheduler (in this example, Schedulers.io)? If so, what is the best way to do that?
David Stemmer
@weefbellington
Jul 21 2015 17:46
(I can think a bunch of naiive ways to block a thread while waiting for a resource to become available, like Object#wait/Object#notify, but I was hoping there might be something more idiomatic to RxJava)