I have a collection of order objects. The collection gets added to, or updated by a listener that listens to order inserts/updates. Simultaneously, the listener also listens to attribute change (order status) caused by a change in entropy.
eg a change is customer credit rating would update all orders of that customer to a suspended status. On either type of update,the listener updates the orders collection on a single dispatcher thread. A scheduled thread clones and processes the orders collection to update the UI periodically.
The requirement is that:
- order updates and inserts should reflect on the UI at the earliest.
- bulk status updates should not block/delay order updates and inserts.
What is a recommended data structure and execution strategy for this situation? We are using Java 7.