public synchronized void lock() {
        LOGGER.trace("Acquiring lock on {}", file.getAbsolutePath());
        try {
            flock = channel.lock();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
Lock the file or throw an exception if the lock is already held
server-common/src/main/java/org/apache/kafka/server/util/FileLock.java