I have an object that is shared by several threads and is an observer. This object has the following methods:
Considering several threads share this object to invoke the execute() method and that the update() method is receiving thousands of notifications from the observable, do I need to synchronize the code inside mehotd update, like this:
Thanks a lot!
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12271
1
posted
0
I certainly would.
Note that there is a lot that could be going on in the Observers, you certainly don't want multiple Threads doing this "simultaneously."