1.wait() and notify() must be called in synchronized code.so if can stop the execution of a Thread.synchronized code is importent,but have synchronized code will not stop soon.
2.call wait() will releases the virtual CPU,So wait() will directly stop the execution of a Thread
3.notify() and notifyall() does is to arbitrarily select one or all of the threads in monitor's waiting pool and moving to the Seeking Lock State.So notify() and notifyall() not directly cause a thread to stop.
4.setPriority can passing in the desired new priority.so soon it will to stop the theard is runging and start that priority is high.
5.sleep() is just sleeping
6.After InputSteam access finish ....
2.call wait() will releases the virtual CPU,So wait() will directly stop the execution of a Thread
3.notify() and notifyall() does is to arbitrarily select one or all of the threads in monitor's waiting pool and moving to the Seeking Lock State.So notify() and notifyall() not directly cause a thread to stop.
4.setPriority can passing in the desired new priority.so soon it will to stop the theard is runging and start that priority is high.
5.sleep() is just sleeping
6.After InputSteam access finish ....
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货