private synchronized void configureLibraryUnderLock(final LmdbLibraryConfig lmdbLibraryConfig) {
        if (!HAS_LIBRARY_BEEN_CONFIGURED) {
            LOGGER.info("Configuring LMDB system library");

            final Path lmdbSystemLibraryPath = Optional.ofNullable(lmdbLibraryConfig.getProvidedSystemLibraryPath())
                    .map(pathCreator::toAppPath)
                    .orElse(null);

            if (lmdbSystemLibraryPath != null) {
                if (!Files.isReadable(lmdbSystemLibraryPath)) {
                    throw new RuntimeException("Unable to read LMDB system library at " +
                            lmdbSystemLibraryPath.toAbsolutePath().normalize());
                }
                // jakarta.validation should ensure the path is valid if set
                final String lmdbNativeLibProp = LmdbLibraryConfig.LMDB_NATIVE_LIB_PROP;
                System.setProperty(lmdbNativeLibProp, lmdbSystemLibraryPath.toAbsolutePath().normalize().toString());
                LOGGER.info("Using provided LMDB system library file. Setting prop {} to '{}'",
                        lmdbNativeLibProp, lmdbSystemLibraryPath);
            } else {
                final Path systemLibraryExtractDir = getLibraryExtractDir(lmdbLibraryConfig);

                // LMDB extracts the lib on boot to a unique temp file and should delete on JVM exit,
                // but just in case clear out any old ones.
                cleanUpExtractDir(systemLibraryExtractDir);

                // Set the location to extract the bundled LMDB binary to
                final String lmdbExtractDirProp = LmdbLibraryConfig.LMDB_EXTRACT_DIR_PROP;
                System.setProperty(
                        lmdbExtractDirProp,
                        systemLibraryExtractDir.toAbsolutePath().normalize().toString());
                LOGGER.info("Bundled LMDB system library binary will be extracted. Setting prop {} to '{}'",
                        lmdbExtractDirProp, systemLibraryExtractDir);
                HAS_LIBRARY_BEEN_CONFIGURED = true;
            }
        } else {
            LOGGER.debug("Another thread beat us to it");
        }
    }
Relies on this class being a singleton
stroom-lmdb/src/main/java/stroom/lmdb/LmdbLibrary.java