Source:
public void loadBlocks() { exec1 = new ExecutorPipeline(8, 1000, true, new Functional.Function<Block, Block>() { @Override public Block apply(Block b) { if (b.getNumber() >= blockchain.getBlockStore().getBestBlock().getNumber()) { for (Transaction tx : b.getTransactionsList()) { tx.getSender(); } } return b; } }, new Functional.Consumer<Throwable>() { @Override public void accept(Throwable throwable) { logger.error("Unhandled exception: ", throwable); } }); exec2 = exec1.add(1, 1000, new Functional.Consumer<Block>() { @Override public void accept(Block block) { try { blockWork(block); } catch (Exception e) { e.printStackTrace(); } } }); String fileSrc = config.blocksLoader(); try { final String blocksFormat = config.getConfig().hasPath("blocks.format") ? config.getConfig().getString("blocks.format") : null; System.out.println("Loading blocks: " + fileSrc + ", format: " + blocksFormat); if ("rlp".equalsIgnoreCase(blocksFormat)) { Path path = Paths.get(fileSrc); byte[] data = Files.readAllBytes(path); RLPList list = RLP.decode2(data); for (RLPElement item : list) { Block block = new Block(item.getRLPData()); exec1.push(block); if (block.getNumber() % 10000 == 0) { dbFlushManager.flushSync(); } } } else { FileInputStream inputStream = new FileInputStream(fileSrc); scanner = new Scanner(inputStream, "UTF-8"); while (scanner.hasNextLine()) { byte[] blockRLPBytes = Hex.decode(scanner.nextLine()); Block block = new Block(blockRLPBytes); exec1.push(block); } } } catch (Exception e) { e.printStackTrace(); System.exit(1); } try { exec1.join(); } catch (InterruptedException e) { throw new RuntimeException(e); } dbFlushManager.flushSync(); System.out.println(" * Done * "); System.exit(0); }

Target:
public void loadBlocks() { exec1 = new ExecutorPipeline(8, 1000, true, new Functional.Function<Block, Block>() { @Override public Block apply(Block b) { if (b.getNumber() >= blockchain.getBlockStore().getBestBlock().getNumber()) { for (Transaction tx : b.getTransactionsList()) { tx.getSender(); } } return b; } }, new Functional.Consumer<Throwable>() { @Override public void accept(Throwable throwable) { logger.error("Unhandled exception: ", throwable); } }); exec2 = exec1.add(1, 1000, new Functional.Consumer<Block>() { @Override public void accept(Block block) { try { blockWork(block); } catch (Exception e) { e.printStackTrace(); } } }); String fileSrc = config.blocksLoader(); try { final String blocksFormat = config.getConfig().hasPath("blocks.format") ? config.getConfig().getString("blocks.format") : null; System.out.println("Loading blocks: " + fileSrc + ", format: " + blocksFormat); if ("rlp".equalsIgnoreCase(blocksFormat)) { Path path = Paths.get(fileSrc); byte[] data = Files.readAllBytes(path); RLPList list = RLP.decode2(data); for (RLPElement item : list) { Block block = new Block(item.getRLPData()); exec1.push(block); } } else { FileInputStream inputStream = new FileInputStream(fileSrc); scanner = new Scanner(inputStream, "UTF-8"); while (scanner.hasNextLine()) { byte[] blockRLPBytes = Hex.decode(scanner.nextLine()); Block block = new Block(blockRLPBytes); exec1.push(block); } } } catch (Exception e) { e.printStackTrace(); System.exit(1); } try { exec1.join(); } catch (InterruptedException e) { throw new RuntimeException(e); } dbFlushManager.flushSync(); System.out.println(" * Done * "); System.exit(0); }