title: Android java.lang.IllegalMonitorStateException: object not locked by thread before wait()
body: <p>I define a global static object as a synchronization lock.</p>
  
  <pre><code>public static Object ConfirmationSynObj = new Object();
  </code></pre>
  
  <p>The following function is what I wrote, but it throw a IllegalMonitorStateException.</p>
  
  <pre><code>       synchronized (Config.ConfirmationSynObj) {
              new Thread(new Runnable() {
  
                  @Override
                  public void run() {
                      //this is a http request
                      appSignInfo = getAPKSignature(context, pkinfo.packageName);
                      Config.ConfirmationSynObj.notify();
                  }
              }).start();
              try {
                  Config.ConfirmationSynObj.wait();
              } catch (InterruptedException e) {
                  e.printStackTrace();
              }
  
              if (appSignInfo == null) {
                  return ret;
              }
          }
  </code></pre>
  
  <p>Does anyone know how to lock an object or a function in order to prevent the concurrency?</p>