I have a variable
private volatile MultiMap myMap;
public void doProcessing {
myMap = getValueFromMainThread()
myForkJoinPool.submit(() -> readWithinMultipleThreads())
}
private void readWithinMultipleThreads() {
readSomethingFrom(myMap.get)
}
I assume this might be enough and do not need myMap to be threadsafe as I read in the child thread and do not modify the state. I am also not sure if I would need volatile at all