Thanks for your quick reply !
According to you blog and what I understood from it (“Advanced RxJava” : you mean it !), I don’t created my own scheduler, because I’m not confident in building my own scheduler. And it force developpers to always use the same scheduler too. I think I can avoid this by returning this custom scheduler in my RxJavaSchedulerHook
. (but as I’m not confident in building my own scheduler, I’m not confident to do this neither)
So, now, I changed my mind, and I stop using a scheduler builded from an Executor
, but, instead, I schedule my task using a standard/common RxJava scheduler (like Schedulers.computation()
, Schedulers.io()
, …). This is this executor, build from an Executor, that doesn’t call the onSchedule
method from my RxJavaSchedulerHook
.
So now, I copy my MDC key before scheduling my action. This action will restore MDC keys. (my code is very close to this code )
Do you think that it’s a good idea ? I’m a little bit worried about the copy of the keys, in term of performane. But I think that we won’t switch from schedulers to schedulers too offen.
Regards