undoublethink
undoublethink
JCHJava Community | Help. Code. Learn.
Created by undoublethink on 3/31/2023 in #java-help
Best way to implement a thread-safe reactive collection elements?
Could do but then it could receive new events before it's finished receiving all old events?
16 replies
JCHJava Community | Help. Code. Learn.
Created by undoublethink on 3/31/2023 in #java-help
Best way to implement a thread-safe reactive collection elements?
I see thread safety issues in two cases: 1. A result arrives while I'm sending the old results to a new client. 2. A result arrives after I've sent the old results but before I've created a "subscription" for new results. I suppose for that to work I'd have to additionally synchronize everything (prevent additions to the queue) while a new client is subscribing? Which is fine and roughly my plan but I was hoping for a better or more standardised solution (this seems like something that is relatively common?)
16 replies
JCHJava Community | Help. Code. Learn.
Created by undoublethink on 3/31/2023 in #java-help
Best way to implement a thread-safe reactive collection elements?
Thanks for the response. Are you able to expand on that? My collection is already a concurrent linked queue but I don't think it solves the problem in this case?
16 replies