@Test
    void testParentMkdirs() throws InterruptedException {
        final HashSet<Path> fileSet = new HashSet<>();

        final String dir = FileSystemTestUtil.getUniqueTestString();
        final Path dir1 = tempDir.resolve(dir);
        // Create 100 files in 10 similar directories
        for (int i = 0; i < 100; i++) {
            final Path dir2 = dir1.resolve(dir);
            final Path dir3 = dir2.resolve("" + (i % 2));
            final Path dir4 = dir3.resolve("" + (i % 2));
            final Path dir5 = dir4.resolve("" + (i % 2));
            final Path file = dir5.resolve("test.dat");
            fileSet.add(file);
        }

        final ExecutorService threadPoolExecutor = Executors.newFixedThreadPool(100);

        final AtomicBoolean allOk = new AtomicBoolean(true);
        for (int i = 0; i < 100; i++) {
            final Runnable r = () -> {
                for (final Path file : fileSet) {
                    try {
                        Files.createDirectories(file.getParent());
                    } catch (final IOException e) {
                        allOk.set(false);
                    }
                }
            };
            threadPoolExecutor.submit(r);
        }

        threadPoolExecutor.shutdown();

        threadPoolExecutor.awaitTermination(100, TimeUnit.SECONDS);

        assertThat(allOk.get()).isTrue();

        FileUtil.deleteDir(dir1);
    }
Here we batch up creating a load of directories as under load this can
fail. This is due to mkdirs not being concurrent (so each thread is
trying to create the same dir).
stroom-data/stroom-data-store-impl-fs/src/test/java/stroom/data/store/impl/fs/TestFileSystemUtil.java