java lock 鎖

需要手動釋放鎖 boolean   lock.tryLock(long time, TimeUtil util);  嘗試申請鎖並持續 time , 申請到返回 true void lock.lockInterruptibly() throws InterruptedException;  持續申請鎖,效果等同與lock.lock(),但是lockInterruptibly() 可以在主線程取消等
相關文章
相關標籤/搜索