Skip to content
This repository has been archived by the owner on Jun 8, 2020. It is now read-only.

RxJava Observables with side effects causing concurrency hazards #402

Open
davidjirovec opened this issue Sep 10, 2019 · 1 comment
Open
Labels

Comments

@davidjirovec
Copy link
Contributor

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.

@badgerwithagun
Copy link
Collaborator

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants