public void add(final Path sourceDir) {
        try {
            lock.lockInterruptibly();
            try {
                // Increment the sequence id.
                final long id = ++writeId;
                queueMonitor.setWritePos(id);
                final Path targetDir = DirUtil.createPath(rootDir, id);
                final Path targetParent = targetDir.getParent();
                try {
                    DirUtil.ensureDirExists(targetParent);
                    Files.move(sourceDir, targetDir, StandardCopyOption.ATOMIC_MOVE);
                    LOGGER.trace("{} ({}) - Added sourceDir {}", name, rootDir, sourceDir);
                } catch (final IOException e) {
                    final boolean targetParentExists = LogUtil.swallowExceptions(
                                    ThrowingSupplier.unchecked(() -> Files.exists(targetParent)))
                            .orElse(false);
                    final boolean sourceExists = LogUtil.swallowExceptions(
                                    ThrowingSupplier.unchecked(() -> Files.exists(sourceDir)))
                            .orElse(false);
                    LOGGER.error("Error moving {} -> {}, sourceExists: {}, targetParentExists: {}, msg: {}",
                            sourceDir, targetDir, sourceExists, targetParentExists, LogUtil.exceptionMessage(e), e);
                    throw new UncheckedIOException(e);
                }
                condition.signalAll();
            } finally {
                lock.unlock();
            }
        } catch (final InterruptedException e) {
            throw UncheckedInterruptedException.create(e);
        }
    }
Add a dir to the queue. In the process this will move the source dir to a dir managed by the queue so that the
process providing the dir will no longer be responsible for managing the supplied dir.

@param sourceDir The source dir to move to the queue.
stroom-proxy/stroom-proxy-app/src/main/java/stroom/proxy/app/handler/DirQueue.java