public static void notify(Object lock){
synchronized (lock) {
    lock.notify();
  }
}

public static void notify ( Object lock ) { synchronized ( lock ) { lock . notify ( ) ; } }
locks the object ( synchronized ) before calling notify
