title: What is the difference between synchronized(this) and synchronized(ClassName.class)?
body: <p>I read somewhere that <code>synchronized(this)</code> should be avoided for <a href="https://stackoverflow.com/a/442601/722603">various reasons</a>. Yet some respectable code that I encountered uses the following in the constructor:</p>
  
  <pre><code>public SomeClass(Context context) {
    if (double_checked_lock == null) {
      synchronized (SomeClass.class) {
        if (double_checked_lock == null) {
          // some code here
        }
      }
    }
  }
  </code></pre>
  
  <p>Is there really a difference between <code>synchronized(this)</code> and <code>synchronized(SomeClass.class)</code>?</p>