private static boolean doMkdirs(final Path superDir, final Path dir, int retry) {
        // Make sure the parent exists first
        final Path parentDir = dir.getParent();
        if (parentDir != null && !Files.isDirectory(parentDir)) {
            if (superDir != null && superDir.equals(parentDir)) {
                // Unable to make parent as it is the super dir
                return false;

            }
            if (!doMkdirs(superDir, parentDir, retry)) {
                // Unable to make parent :(
                return false;
            }
        }
        // No Make us
        if (!Files.isDirectory(dir)) {
            // * CONCURRENT PROBLEM AREA *
            try {
                Files.createDirectory(dir);
            } catch (final IOException e) {
                LOGGER.debug("Failed to make dir " + e.getMessage());
            }

            try {
                // Someone could have made it in the * CONCURRENT PROBLEM AREA *
                if (!Files.isDirectory(dir)) {
                    if (retry > 0) {
                        retry = retry - 1;
                        LOGGER.warn("doMkdirs() - Sleep and Retry due to unable to create " + FileUtil.getCanonicalPath(
                                dir));
                        Thread.sleep(MKDIR_RETRY_SLEEP_MS);
                        return doMkdirs(superDir, dir, retry);
                    } else {
                        return false;
                    }
                }
            } catch (final InterruptedException e) {
                LOGGER.error(e.getMessage(), e);

                // Continue to interrupt this thread.
                Thread.currentThread().interrupt();
            }
        }
        return true;
    }
<p>
Utility method to create directories one by one (rather than call Java
API mkdirs). We do this to ensure if we fail to make one we check that it
has not been created between that last time we checked.
</p>
<p>
<p>
WE ASSUME here that mkdir is ATOMIC .... which it is.
</p>
stroom-data/stroom-data-store-impl-fs/src/main/java/stroom/data/store/impl/fs/FileSystemUtil.java