How to use wait、notify、notifyAll methods
These methods can be used in a synchronized block.
These methods can work when the thread holds the lock.
wait
Relinquishes the lock
notify/notifyAll
Relinquishes the lock after synchronized block
See also javadoc.