private void atomicWrite(Path path, PathOperation pathOperation) throws IOException {
        Path tempFile = null;
        try {
            tempFile = Files.createTempFile(path.getParent(), "nginx", "");
            pathOperation.run(tempFile);
            Files.move(tempFile, path, StandardCopyOption.ATOMIC_MOVE, StandardCopyOption.REPLACE_EXISTING);
        } finally {
            if (tempFile != null) {
                Files.deleteIfExists(tempFile);
            }
        }
    }
Apply pathOperation to a temporary file, then atomically move the temporary file to path
routing-generator/src/main/java/com/yahoo/vespa/hosted/routing/nginx/Nginx.java