public static void releaseLock(FileLock lock) throws IOException {
        String lockPath = LOCK_MAP.remove(lock);
        if (lockPath == null) {
            throw new LockException("Cannot release unobtained lock");
        }
        lock.release();
        lock.channel().close();
        boolean removed = LOCK_HELD.remove(lockPath);
        if (!removed) {
            throw new LockException("Lock path was not marked as held: " + lockPath);
        }
    }
@Test(expected = LockException.class)
    public void ReleaseUnobtainedLock() throws IOException {
        FileLockFactory.releaseLock(lock);
        FileLockFactory.releaseLock(lock);
    }