title: Java synchronization with callback
body: <p>I am developing a module inside my system where based on some event the user has to receive sms. </p>
  
  <p>I have the following situation</p>
  
  <pre><code>synchronized(notificationPhoneNumber)
  {
      SmsProvider.sendSms(notificationPhoneNumber, smsText);
  }
  </code></pre>
  
  <p>The code of the method sendSms is running asynchronious:</p>
  
  <pre><code>public static void send(final NotificationPhoneNumber npn, final String smsText)
  {
      Thread smsSender = new Thread(new Runnable()
      {
          public void run()
          {
             //sms sending code runs here....
          }
  
      }); 
  
      smsSender.start();
  }
  </code></pre>
  
  <p>So the question is how long is the notificationPhoneNumber object locked in this case? Is it going to be locked by the time the thread finishes its job or not?</p>