notifyAll激活等待在该对象的监视器上的全部线程。 线程通过调用 wait 方法等候在某个对象的监视器中。 
只有该对象监视器的拥有者线程才能调用这个方法。 参见 notify 方法,那里有线程如何成为监视器所有者的说明。

解决方案 »

  1.   

    T3不是T1 T2的owner,所以notifyAll对T1 T2不起作用。
      

  2.   

    具体可以看JDK的注解 This method should only be called by a thread that is the owner of this object's monitor. A thread becomes the owner of the object's monitor in one of three ways:    * By executing a synchronized instance method of that object.
        * By executing the body of a synchronized statement that synchronizes on the object.
        * For objects of type Class, by executing a synchronized static method of that class.