167168169170171172173174175176177
this.name = name; } public void lock() { LockDAO lockDAO = new LockDAO(); lockDAO.create(directory, name); } public void lockInterruptibly() throws InterruptedException { lock(); }
181182183184185186187188189190191
} public boolean tryLock() { LockDAO lockDAO = new LockDAO(); if (lockDAO.findByDirectoryAndName(directory, name) == null) { lockDAO.create(directory, name); return true; } return false; }
4243444546474849505152
if (lock != null) { return false; } lockDAO.create(directory, lockName); return true; } @Override