public synchronized void lock() throws IOException {
        LOGGER.trace("Acquiring lock on {}", file.getAbsolutePath());
        flock = channel.lock();
    }
@Test
    void testLock() throws IOException {
        File tempFile = TestUtils.tempFile();
        FileLock lock1 = new FileLock(tempFile);
        try {
            lock1.lock();
            assertThrows(OverlappingFileLockException.class, lock1::lock);

            FileLock lock2 = new FileLock(tempFile);
            assertThrows(OverlappingFileLockException.class, lock2::lock);
            assertFalse(lock2.tryLock());
            lock1.unlock();
        } finally {
            lock1.destroy();
        }
    }