title: Should I synchronize notifyObservers calls?
body: <p>I've found this implementation of Observable:</p>
  
  <pre><code>public class ObservableObject extends Observable {
      private static ObservableObject instance = new ObservableObject();
  
      public static ObservableObject getInstance() {
          return instance;
      }
  
      private ObservableObject() {
      }
  
      public void updateValue(Object data) {
          synchronized (this) {
              // The call to setChanged marks this Observable object as having been changed; the hasChanged method will now return true.
              setChanged();
              notifyObservers(data);
          }
      }
  }
  </code></pre>
  
  <p>What I'm trying to understand is what is the difference between the <a href="http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8u40-b25/java/util/Observable.java#132" rel="nofollow">default implementation</a> use of synchronized block and the use of synchronized block at the code I found above, is there a need for both?, is there a better(correct) way?</p>