Java??????????????????????
???????????? ???????[ 2013/6/20 10:51:33 ] ????????
????????????
??????????????synchronized???ε????????this????飬?????????????????????????????Щ???????????????
?????????????????????Э?????????????ReentrantLock??????????????????????????????????????ж????????????????????????м???????????????????????????????????ж?????????????????????????????????????????????????????
????ReentrantLock?????÷??
Lock lock=new ReentrantLock();
lock.lock();
try{
//????????
}finally{
lock.unlock();
}
???????????????з???????????????????????????????μ????????????????????????????????????????????е????????????????????????????????????е???????????????????????????????
?????????????????????
????lock()???????????
?????????????б??κ????????У????????????????????????????1.
?????????????????????????У??????????????????????1.
?????????????????????????У???????????????????????????
????tryLock??time?????????????ж?????
???????????????????????б??κ?????????У??????????б??ж??????????????????true????????????1.
?????????????????????????У???????????true????????????1.
?????????????????????????У?????????????????????????????????????????
????????????????????????ж???????
??????????????????????????????У?????true??????????л??????????false
????lockInterruptibly()???????????ж?????
???????????????????????????б??ж???????????????
?????????????б??κ????????У????????????????????????????1.
?????????????????????????У??????????????????????1.
?????????????????????????У???????????????????????????????????????????
????????????????????????ж?
????tryLock()?????????????
?????????????б??κ????????????????????????true????????????1.
?????????????????????????У???????????true????????????1.
?????????????????????????У???????????false??
????unlock()???????
???????????????????????????????????? 1????????????????? 0??????????
??????????ReentrantLock?????????????????????boolean??????????????false?????????????????????????true?????????????????????
??????ν???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????synchronized??ReentrantLock?????
?????????????synchronized??????????????????????????????ж???????????????????е??????????????ReentrantLock??
??????????д?????У????????????????е??-д?????У???ReentrantReadWriteLock.
??????

???·???
App??С????H5?????????????????Щ??
2024/9/11 15:34:34?????????????????????????
2024/9/10 11:13:49P-One ???????????????????????????????????????
2024/9/10 10:14:12???????????????????????????
2024/9/9 18:04:26??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44