// 一种可重入的独占锁
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();
}
网友评论