I'm currently designing a server with the following structure:
ConcurrentHashMapis read, and results analyzed. After the work is complete, the results are posted to a write queue.
ConcurrentHashMap, a write will get posted to the network several seconds before a read gets posted to the network. The threads must never allow the read to get scheduled before the write occurs.
My ideas so far:
Are there any ways to ensure that reads have a low chance of occurring before a write or are the precautions I've already taken sufficient? Should I use the read retry mechanism?
Also, is a write queue actually needed or can I just use worker threads more generally to also handle writes? Write order is not important.