wait().notify().notifyAll()是三个定义在Object类里的方法,可以用来控制线程的状态. public final native void wait(long timeout) throws InterruptedException; public final native void notify(); public final native void notifyAll(); 这三个方法最终调用的都是jvm级的final native方法.随着jvm运行平台的不同可能
wait().notify().notifyAll()是三个定义在Object类里的方法,可以用来控制线程的状态 public final native void notify(); public final native void notifyAll(); public final native void wait(long l) throws InterruptedException; public final void wait(long l, int i) throws Interrup
Java的Object类 public class Object { public final native void notify(); public final native void notifyAll(); public final native void wait(long timeout) throws InterruptedException; } 调用这些方法的当前线程必须拥有此对象监视器,否则将会报java.lang.IllegalMonitorStateException e