protected void unlockForce(String lock_name) { Map<Owner,ClientLock> owners=table.get(lock_name); if(owners != null) { for(ClientLock cl : owners.values()) cl._unlock(true); } pending_release_reqs.removeIf(cl -> Objects.equals(cl.name, lock_name)); }
protected synchronized void acquire(boolean throwInterrupt) throws InterruptedException { if(acquired) return; if(throwInterrupt && Thread.interrupted()) throw new InterruptedException(); owner=getOwner(); sendGrantLockRequest(name, lock_id, owner, 0, false); boolean interrupted=false; while(!acquired) { try { this.wait(); } catch(InterruptedException e) { if(throwInterrupt && !acquired) { _unlock(true); throw e; } // If we don't throw exceptions then we just set the interrupt flag and let it loop around interrupted=true; } } if(interrupted) Thread.currentThread().interrupt(); }
_unlock(true); return retval;
_unlock(true); return retval;
protected synchronized void acquire(boolean throwInterrupt) throws InterruptedException { if(acquired) return; if(throwInterrupt && Thread.interrupted()) throw new InterruptedException(); owner=getOwner(); sendGrantLockRequest(name, lock_id, owner, 0, false); boolean interrupted=false; while(!acquired) { try { this.wait(); } catch(InterruptedException e) { if(throwInterrupt && !acquired) { _unlock(true); throw e; } // If we don't throw exceptions then we just set the interrupt flag and let it loop around interrupted=true; } } if(interrupted) Thread.currentThread().interrupt(); }
public synchronized void unlock() { _unlock(false); }
protected void unlockForce(String lock_name) { Map<Owner,ClientLock> owners=table.get(lock_name); if(owners != null) { for(ClientLock cl : owners.values()) cl._unlock(true); } pending_release_reqs.removeIf(cl -> Objects.equals(cl.name, lock_name)); }
public synchronized void unlock() { _unlock(false); }