protected final <T, E extends Exception> T maybeLock(Lock lock, StorageAction<T, E> action) throws E {
        if (OperatingSystem.IS_WINDOWS || OperatingSystem.IS_ZOS)
            lock.lock();
        try {
            return action.execute();
        } finally {
            if (OperatingSystem.IS_WINDOWS || OperatingSystem.IS_ZOS)
                lock.unlock();
        }
    }
Execute the given function in a lock only if we are running on windows or z/OS. We do this
because Windows or z/OS won't let us resize a file while it is mmapped. As a result we have to force unmap it
and this requires synchronizing reads.
storage/src/main/java/org/apache/kafka/storage/internals/log/AbstractIndex.java