class BlockLoader {

    public boolean loadBlocks(Function<Path, DumpWalker> walkerFactory, Path... paths) {
        if (ArrayUtils.isEmpty(paths)) {
            logger.warn("There is nothing to import.");
            return false;
        }

        initPipelines();

        AtomicLong maxBlockNumber = new AtomicLong();
        boolean allBlocksImported;
        try {

            for (Path dump : paths) {
                try (DumpWalker walker = walkerFactory.apply(dump)) {
                    walker.forEach(rlp -> {
                        Block block = new Block(rlp);
                        if (maxBlockNumber.get() < block.getNumber()) {
                            maxBlockNumber.set(block.getNumber());
                        }
                        exec1.push(block);
                    });
                }
            }

            exec1.join();
            dbFlushManager.flushSync();

            allBlocksImported = maxBlockNumber.get() == blockchain.getBestBlock().getNumber();
        } catch (Exception e) {
            e.printStackTrace();
            allBlocksImported = false;
        }

        if (allBlocksImported) {
            System.out.printf("All of %s blocks was successfully loaded.\n", maxBlockNumber);
        } else {
            System.out.printf("Some blocks have been lost during the loading.");
        }

        return allBlocksImported;
    }

    @Autowired public  BlockLoader(BlockHeaderValidator headerValidator, Blockchain blockchain, DbFlushManager dbFlushManager);

}