Consider the observer pattern [ref] … The code in Figure 1 is not thread … be modified [during iteration] … , triggering an exception … [p. 36] [Adding the Java keyword synchronized] is unwise because it can lead … This [improved] code is still not correct, however. … But listeners might be notified of value changes … the wrong one. This pattern can be made … required some rather intricate thinking about possible interleavings. …
Google-1
Google-2
Copyright clearance needed for quotation.