this.label=label;
}
public void lock(long timeout, boolean readOnly) throws LockException, LockInterruptedException {
if(timeout<=0) throw new LockException("timeout must be a postive number");
try {
if(!getLock(readOnly).tryLock(timeout, TimeUnit.MILLISECONDS)){
throw new LockException(timeout);
}
}
catch (InterruptedException e) {
throw new LockInterruptedException(e);
}