https://issues.apache.org/bugzilla/show_bug.cgi?id=54717
--- Comment #10 from Sebb <[email protected]> --- (In reply to Danny Lade from comment #9) > > IMHO this is not necessary to synchronize the sample store if you're using > an own store for each thread (see my attachment). Only true if there is no access from other threads. > The only catch is, that testEnded() runs in the main thread. This is why I > use the queue of maps to store all maps of the threads on one central point. > But the queue is only accessed two times 1) at the initializing for each > thread (see statisticalMapSelector) and 2) at the testEnded() method. > > This is why I don't need to synchronize or lock at all. Synchronisation is not only needed to guarantee single-threaded access to critical points in the code. It is also needed to ensure safe publication across threads. The Java memory model allows threads cache values locally; threads only have to update/fetch main memory at a memory synch. point. If one thread updates a field, another thread may not see the new value unless both the threads synch. on the same lock (volatile can also be used in some cases). -- You are receiving this mail because: You are the assignee for the bug.
