你能不能告诉我是否应该在等待条件之前释放锁?
try { lock.lock(); while (isNotEmpty()) { condition.await(); } } finally { lock.unlock(); }
要么
try { lock.lock(); while (isNotEmpty()) { lock.unlock(); condition.await(); } } finally { lock.unlock(); }