syncronized 같은 암묵적인 락의 외에 자바 5에 추가된 명시적인 락
interface Lock {
void lock();
void lockInterruptibly() throws InterruptedException;
boolean tryLock();
boolean tryLock(long timeout, TimeUnit unit) throws InterruptedException; // 락 확보 타임아웃 지정가능
void unlock();
Condition newCondition();
}
Lock lock = new ReentranceLock();
lock.lock();
try {
// 어쩌구
} finally {
lock.unlock(); // 반드시 락을 해제해주어야함!
}