bitrich-info/xchange-stream

RxJava Observables with side effects causing concurrency hazards

Opened this issue · 1 comments

Related to #387

ob.bids.forEach((key, value) -> subscription.orderBook.update(new OrderBookUpdate(

Orderbook which is modified here can be iterated downstream in the same time which causes ConcurrentModificationException. I believe clean solution to this is not to add synchronized as in #387 but to use Observables without side effects and pass immutable objects, or at least when modification of mutable object is needed, create a copy.

Yes, this problem is endemic. I've never tried because there's so much of this sort of code that to remove the downstream protections in my app would require me to find and eliminate every single one of these smells, and there are too many.