OneToThreeDiamondSequencedThroughputTest event data structure usage clarification

73 views
Skip to first unread message

Dmitry Zagorulkin

unread,
May 24, 2019, 11:19:37 AM5/24/19
to Disruptor
Hello folks!
I'm trying to understand does is safe to use consecutive data structure (List, Map) in diamond like scenario? 

*           +-----+
* +----->| EP1 |------+
* | +-----+ |
* | v
* +----+ +-----+
* | P1 | | EP3 |
* +----+ +-----+
* | ^
* | +-----+ |
* +----->| EP2 |------+
* +-----+

When P1 produces some data e.g., List then EP1 and EP2 adds to this list something. Does it possible to get ConcurrentModificationException? 
Should i use any concurrent data structure for this purpose? 

Olivier Coanet

unread,
May 25, 2019, 10:21:36 AM5/25/19
to Disruptor
Hello.

It would not be thread-safe to add elements to the list from both EP1 and EP2. You could use a concurrent list, but in my view it would be simpler to produce data in two distinct lists, and then process those lists in EP3.

I hope this will help.

Dmitry Zagorulkin

unread,
May 27, 2019, 3:10:15 AM5/27/19
to Disruptor
Thank you, Olivier.
It really helps.
Reply all
Reply to author
Forward
0 new messages