Java?ж????????
???????????? ???????[ 2016/8/5 16:50:41 ] ???????????
????Thread.stop?? Thread.suspend?? Thread.resume ??Runtime.runFinalizersOnExit ??Щ?????????е??????????????????????????????????
????????????????????Ч??????????????ò?????????Щ??????
????1??????????????????????????
?????????run???????????????????????????
????2???????Щ?????????????????????С?
???????????????Щ????????????????????????????У?????????Щ?????????????£?????????Щ????
?????????????????????while(true)????????С?
??????:
@Override
publicvoid run() {
while(true){
someWork();
if(finished){
break;
}
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
/* TODO??????? catch ??
*
*/
e.printStackTrace();
}
}
}
?????????????while????????????????????????????????????????????????????break?????????????????????????????????????????????
????3??????InterruptedException ??????????ж???????
??????Щ?????????????????while(true)??????????????????????????е????????????????????????????????????÷?????з????????????????????????У??????????????????
?????????????????????interrupt?????????????InterruptedException????????????????е????????????????????????????л???????????????С?
?????磺
@Override
publicvoid run() {
while(true){
try {
// getSendMessages ??BlockingQueue??????take??????????????
responseMessage = this.getSendMessages().take();
} catch (InterruptedException e1) {
thrownew RuntimeException();
//????break;
}
someWork();
}
???????????Thread ???? ?????????? ????????????????????????thread?????interrupt() ??????????
????responseMessage = this.getSendMessages().take();
????????????в??????InterruptedException???????????????????????????????????????break??????????????????????
??????

???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11