protected GlobalLock lock(final String lockName) { final TryAcquireLockState lockState = lockTable.tryAcquireLockForExistingOwner(lockName); if (lockState.getLockState() == ReentrantLock.ReentrantLockState.HELD_OWNER) { return lockState.getOriginalLock(); } if (lockState.getLockState() == ReentrantLock.ReentrantLockState.HELD_NOT_OWNER) { // In that case, we need to respect the provided timeout value try { Thread.sleep(TimeUnit.MILLISECONDS.convert(timeout, timeUnit)); } catch (final InterruptedException e) { Thread.currentThread().interrupt(); logger.warn("lock got interrupted", e); } return null; } return doLock(lockName); }