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

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