title: Null check and listeners in java
body: <p>Very often I see code like this:</p>
  
  <pre><code>Listener mListener;
  
  public void setListener(Listener listener){
     mListener=listener;
  }
  
  public void fooFunction(){
     ...
     ...
     if (mListener!=null){
        mListener.notifyFoo();
     }
  }
  </code></pre>
  
  <p>My question is: what if between the null check and the notifyFoo() another thread calls setListener(null)? Is that possible? or does the compiler make it atomical</p>