sleep() 属于Thread的方法,不释放锁,自动唤醒或者interrupt打断
wait() 属于Object的方法,释放锁,不会被自动唤醒,用notify() or notifyall()唤醒
notify() / notifyall() 唤醒 任意一个 / 全部 在此对象上等待的线程
Wakes up a single thread that is waiting on this object's
monitor. If any threads are waiting on this object, one of them
is chosen to be awakened. The choice is arbitrary and occurs at
the discretion of the implementation. A thread waits on an object's
monitor by calling one of the {@code wait} methods.
注:wait()和notify() ofityall()是配合着使用,且是在多线程状态下。