It is being declared that PublishSubject is not thread safe in RxJava. Ok.
I'm trying to find any example, I'm trying to construct any example to emulate race condition, that leads to unwanted results. But I can't :(
Can anyone provide an example proving that PublishSubject is not thread safe?
Usually, people ask why their setup behaves unexpectedly and/or crashes and the answer is: because they call the onXXX methods on the
Subject
concurrently:I've found the proof. I think this example more obvious then @akarnokd provided.