private void initializeWithRaftManager() {
        raftManager.startup();
        this.loader = new MetadataLoader.Builder().
                setFaultHandler(faultHandler).
                setNodeId(-1).
                setHighWaterMarkAccessor(() -> raftManager.client().highWatermark()).
                build();
        raftManager.register(loader);
    }
Take the FileLock in the given directory.
shell/src/main/java/org/apache/kafka/shell/MetadataShell.java