Reprinted from:
Sleep (), yield (), wait () The difference is detailed: http://dylanxu.iteye.com/blog/1322066
The Join method is detailed: http://www.open-open.com/lib/view/open1371741636171.html
Description of difference:
Sleep (millsec) method: Causes the method's owning thread to pause millsec milliseconds, allowing other threads to be executed, but does not release the object lock .
Yield () method: Similar to the Sleep method, but cannot specify the time, and only the same priority thread has the opportunity to be executed.
Wait () method: Suspends the thread that the method belongs to and frees the object lock, while allowing the thread of the method to enter the " Waiting Pool " until a notify () or Notifyall () method is called, to be moved from the waiting pool to the lock flag waiting pool (only the lock flag waits for the thread in the pool to get the lock flag ).
Notify () Method: Remove a thread from the wait pool into the lock flag waiting pool .
Notifyall () Method: Move all the threads in the wait pool to the lock flag waiting pool .
Java thread method parsing: Sleep join wait notify Notifyall