ReentrantLock
2022-08-12 本文已影响0人
chrisghb
// 一种可重入的独占锁
ReentrantLock lock=new ReentrantLock();
Condition Condition = lock.newCondition();
lock.lock();
Condition.await();
// https://segmentfault.com/a/1190000015807209
Condition.signal();
try {
} catch (Exception e) {
logger.error(e);
}finally{
lock.unlock();
}